Page 1 of 1

Catching SQLITEFULL exception

Posted: Wed Jul 17, 2019 6:05 pm
by deepti
Hi,

Currently our application has several exception catch blocks like this:

Code: Select all

catch (wxSQLite3Exception& e)
 {
 //log the exception message
 }
 
I read in the documentation that SQLITEFULL exception can occur even when writing to temporary files like journal files.
Now, i need a way to shutdown the application in case of SQLITEFULL exception.
But, checking if the exception type is SQLITEFULL in each of these catch blocks does not seem like a great approach.
Is there a simpler way to do this?
Please help!

Re: Catching SQLITEFULL exception

Posted: Wed Jul 17, 2019 9:41 pm
by utelle
deepti wrote:
Wed Jul 17, 2019 6:05 pm
Currently our application has several exception catch blocks like this:

Code: Select all

catch (wxSQLite3Exception& e)
{
  // log the exception message
} 
I read in the documentation that SQLITE_FULL exception can occur even when writing to temporary files like journal files.
Yes, that is correct.
deepti wrote:
Wed Jul 17, 2019 6:05 pm
Now, i need a way to shutdown the application in case of SQLITE_FULL exception.
But, checking if the exception type is SQLITE_FULL in each of these catch blocks does not seem like a great approach.
Is there a simpler way to do this?
No. If you catch a wxSQLite3Exception, then you have to handle the exception.

To avoid code duplication, you could write a separate function, which checks for this special condition, and - if the error code was SQLITE_FULL - this function could then throw an application specific condition, which you then catch in your main application, or this function could shutdown the application directly. Then you add a call to this function in each catch block.

Re: Catching SQLITEFULL exception

Posted: Tue Aug 06, 2019 12:39 pm
by deepti
Thank you Utelle for your detailed explanation.