Sqlite throws an assert() and crashes when it reads a corrupt db.  (Sqlite 
is fine, our recording medium is flaky.)  I'd like to catch the assert() and 
report an error without crashing.

The problem is, sqlite throws assert() from functions that don't return an 
error code.  So, there's no way to simply return an error and unwind the 
function call stack.  So, I can see a few options, none of them good

1. Prevent asserts from happening:
GOOD: that's the way things should be
BAD: unfortunately I can't fix our recording medium.

2. Make every sqlite function catch errors, clean up, and return an error 
code when assertions fail.
GOOD: that's the way things should be
BAD:  That's a big modification

3. Use setjmp and longjmp to unwind the stack on assert().
GOOD: easy to implement
BAD: that won't clean up resources.

Anyone else working on this?  If not, I'll start coding #3.

--Noel

Reply via email to