mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
add more error types to backend
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3544 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -31,6 +31,29 @@
|
||||
|
||||
/* static short module = MOD_ENGINE; */
|
||||
|
||||
/********************************************************************\
|
||||
* error handling *
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
xaccBackendSetError (Backend *be, GNCBackendError err)
|
||||
{
|
||||
if (!be) return;
|
||||
be->last_err = err;
|
||||
}
|
||||
|
||||
GNCBackendError
|
||||
xaccBackendGetError (Backend *be)
|
||||
{
|
||||
GNCBackendError err;
|
||||
if (!be) return ERR_BACKEND_NO_BACKEND;
|
||||
|
||||
/* use 'stack-pop' semantics */
|
||||
err = be->last_err;
|
||||
be->last_err = ERR_BACKEND_NO_ERR;
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* Fetch the backend *
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
|
||||
typedef enum {
|
||||
ERR_BACKEND_NO_ERR = 0,
|
||||
ERR_BACKEND_MISC,
|
||||
ERR_BACKEND_NO_BACKEND, /* Backend * pointer was null the err routine */
|
||||
ERR_BACKEND_MISC, /* undetermined error */
|
||||
|
||||
/* fileio errors */
|
||||
ERR_BFILEIO_FILE_BAD_READ,
|
||||
@@ -38,10 +39,19 @@ typedef enum {
|
||||
ERR_BFILEIO_ALLOC,
|
||||
|
||||
/* network errors */
|
||||
ERR_NETIO_NO_CONNECTION,
|
||||
ERR_NETIO_SHORT_READ,
|
||||
ERR_NETIO_WRONG_CONTENT_TYPE,
|
||||
ERR_NETIO_NOT_GNCXML
|
||||
ERR_NETIO_NO_CONNECTION, /* network failure */
|
||||
ERR_NETIO_SHORT_READ, /* not enough bytes received */
|
||||
ERR_NETIO_WRONG_CONTENT_TYPE, /* wrong kind of server, wrong data served */
|
||||
ERR_NETIO_NOT_GNCXML,
|
||||
|
||||
/* database errors */
|
||||
ERR_SQL_BUSY, /* single-mode access doesn't allow other users */
|
||||
ERR_SQL_CANT_CONNECT, /* network failure */
|
||||
ERR_SQL_SEND_QUERY_FAILED,
|
||||
ERR_SQL_FINISH_QUERY_FAILED,
|
||||
ERR_SQL_GET_RESULT_FAILED,
|
||||
ERR_SQL_CORRUPT_DB,
|
||||
ERR_SQL_MISSING_DATA, /* database doesn't contain expected data */
|
||||
} GNCBackendError;
|
||||
|
||||
|
||||
@@ -128,6 +138,17 @@ struct _backend
|
||||
GNCBackendError last_err;
|
||||
};
|
||||
|
||||
/*
|
||||
* The xaccBackendSetError() routine pushes an error code onto the error
|
||||
* stack. (FIXME: the stack is 1 deep in current implementation).
|
||||
*
|
||||
* The xaccBackendGetError() routine pops an error code off the error
|
||||
* stack.
|
||||
*/
|
||||
|
||||
void xaccBackendSetError (Backend *, GNCBackendError err);
|
||||
GNCBackendError xaccBackendGetError (Backend *);
|
||||
|
||||
/*
|
||||
* The xaccGetAccountBackend() subroutine will find the
|
||||
* persistent-data storage backend associated with this account.
|
||||
|
||||
Reference in New Issue
Block a user