8000 Cannot catch constraint exception · Issue #53 · SqliteModernCpp/sqlite_modern_cpp · GitHub
[go: up one dir, main page]

Skip to content
Cannot catch constraint exception #53
Closed
@pakerwreah

Description

@pakerwreah

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0