Closed rogerbinns closed 1 year ago
There is now a CHAIN_EXC macro in the code that does this. However in most places a secondary exception is not because of the developer's handling of the first exception, but rather SQLite deciding to do other things.
There are many places in the code where exceptions can occur while already handling exceptions.
For example Connection.__exit__ may be called and then the execution tracer has an exception so rollback is attempted but sqlite3_mprintf then has an error etc.
It should be possible to chain the cascading exceptions using _PyErr_ChainExceptions - see PEP 490