Closed
Description
I'm trying to insert a row that produces a primary key constraint failure but the program crashes before I can catch the exception.
try {
db << "INSERT INTO tb_mytable (mytable_id,description) VALUES (?,?)" << 1 << "cannot catch exception";
// inserting again to produce error
db << "INSERT INTO tb_mytable (mytable_id,description) VALUES (?,?)" << 1 << "cannot catch exception";
} catch (exception e)
{
cerr << e.what() << endl;
} catch (...)
{
cerr << "this does not work either" << endl;
}
libc++abi.dylib: terminating with uncaught exception of type sqlite::exceptions::constraint: constraint failed
The program has unexpectedly finished.
Metadata
Metadata
Assignees
Labels
No labels