r20298 - gnucash/trunk/src/libqof/qof - QofSession: Don't push a new generic error if there's already one available that might be more descriptive.
John Ralls
jralls at code.gnucash.org
Sun Feb 13 19:17:50 EST 2011
Author: jralls
Date: 2011-02-13 19:17:50 -0500 (Sun, 13 Feb 2011)
New Revision: 20298
Trac: http://svn.gnucash.org/trac/changeset/20298
Modified:
gnucash/trunk/src/libqof/qof/qofsession.c
Log:
QofSession: Don't push a new generic error if there's already one available that might be more descriptive.
Modified: gnucash/trunk/src/libqof/qof/qofsession.c
===================================================================
--- gnucash/trunk/src/libqof/qof/qofsession.c 2011-02-13 20:19:45 UTC (rev 20297)
+++ gnucash/trunk/src/libqof/qof/qofsession.c 2011-02-14 00:17:50 UTC (rev 20298)
@@ -1114,7 +1114,8 @@
/* Check to see if this session is already open */
if (session->book_id)
{
- qof_session_push_error (session, ERR_BACKEND_LOCKED, NULL);
+ if (ERR_BACKEND_NO_ERR != qof_session_get_error(session))
+ qof_session_push_error (session, ERR_BACKEND_LOCKED, NULL);
LEAVE("push error book is already open ");
return;
}
@@ -1122,7 +1123,8 @@
/* seriously invalid */
if (!book_id)
{
- qof_session_push_error (session, ERR_BACKEND_BAD_URL, NULL);
+ if (ERR_BACKEND_NO_ERR != qof_session_get_error(session))
+ qof_session_push_error (session, ERR_BACKEND_BAD_URL, NULL);
LEAVE("push error missing book_id");
return;
}
@@ -1149,7 +1151,8 @@
{
g_free(session->book_id);
session->book_id = NULL;
- qof_session_push_error (session, ERR_BACKEND_BAD_URL, NULL);
+ if (ERR_BACKEND_NO_ERR == qof_session_get_error(session))
+ qof_session_push_error (session, ERR_BACKEND_BAD_URL, NULL);
LEAVE (" BAD: no backend: sess=%p book-id=%s",
session, book_id ? book_id : "(null)");
return;
@@ -1401,8 +1404,11 @@
}
if (!session->backend)
{
- msg = g_strdup_printf("failed to load backend");
- qof_session_push_error(session, ERR_BACKEND_NO_HANDLER, msg);
+ if (ERR_BACKEND_NO_ERR != qof_session_get_error(session))
+ {
+ msg = g_strdup_printf("failed to load backend");
+ qof_session_push_error(session, ERR_BACKEND_NO_HANDLER, msg);
+ }
goto leave;
}
}
@@ -1440,8 +1446,11 @@
}
else
{
- msg = g_strdup_printf("failed to load backend");
- qof_session_push_error(session, ERR_BACKEND_NO_HANDLER, msg);
+ if (ERR_BACKEND_NO_ERR != qof_session_get_error(session))
+ {
+ msg = g_strdup_printf("failed to load backend");
+ qof_session_push_error(session, ERR_BACKEND_NO_HANDLER, msg);
+ }
}
LEAVE("error -- No backend!");
leave:
More information about the gnucash-changes
mailing list