Correct the type of error variables.

C++ doesn't like interchanging enums and ints.
This commit is contained in:
John Ralls 2018-06-01 14:00:52 -07:00
parent 464fdeeb26
commit f504e39d78
4 changed files with 7 additions and 5 deletions

View File

@ -97,7 +97,8 @@ public:
void safe_sync(QofBook*) override;
bool connected() const noexcept { return m_conn != nullptr; }
/** FIXME: Just a pass-through to m_conn: */
void set_dbi_error(int error, unsigned int repeat, bool retry) noexcept
void set_dbi_error(QofBackendError error, unsigned int repeat,
bool retry) noexcept
{
m_conn->set_error(error, repeat, retry);
}

View File

@ -64,7 +64,7 @@ public:
return dbi_conn_error(m_conn, nullptr); }
QofBackend* qbe () const noexcept { return m_qbe; }
dbi_conn conn() const noexcept { return m_conn; }
inline void set_error(int error, unsigned int repeat,
inline void set_error(QofBackendError error, unsigned int repeat,
bool retry) noexcept override
{
m_last_error = error;
@ -96,7 +96,7 @@ private:
/** Code of the last error that occurred. This is set in the error callback
* function.
*/
int m_last_error;
QofBackendError m_last_error;
/** Used in case of transient errors. After such error, another attempt at
* the original call is allowed. error_repeat tracks the number of attempts
* and can be used to prevent infinite loops.

View File

@ -93,7 +93,8 @@ public:
* If not 0 will normally be meaningless outside of implementation code.
*/
virtual int dberror() const noexcept = 0;
virtual void set_error(int error, unsigned int repeat, bool retry) noexcept = 0;
virtual void set_error(QofBackendError error, unsigned int repeat,
bool retry) noexcept = 0;
virtual bool verify() noexcept = 0;
virtual bool retry_connection(const char* msg) noexcept = 0;

View File

@ -118,7 +118,7 @@ public:
virtual std::string quote_string (const std::string& str)
const noexcept override { return std::string{str}; }
int dberror() const noexcept override { return 0; }
void set_error(int error, unsigned int repeat, bool retry) noexcept override { return; }
void set_error(QofBackendError error, unsigned int repeat, bool retry) noexcept override { return; }
bool verify() noexcept override { return true; }
bool retry_connection(const char* msg) noexcept override { return true; }
private: