I have got follow Dart code:
try
{
print("!1111111111");
await db.KVToTableInsert(tableToInsert);
print("!2222222222");
return dbEnums.success;
} on PostgreSQLException
{
print("Fail is here");
}
In console I am getting:
!1111111111
Unhandled exception:
PostgreSQLSeverity.unknown 23505
I tried to:
on Exception {print("Base Exception");}
but this code was not executed.
in KVToTableInsert
I am getting Exception:
KVToTableInsert(String tablename) async {
// ...
List<List<dynamic>> results = await connection.query(sql); // PostgreSQLException (PostgreSQLSeverity.unknown 23505
}
As I understand the exception is should be handled on top level.
Why handling exception do not work?
postgresql 13
Screenshot: https://images.guru/i/dBWpe
KVToTableInsert
with added await-async https://gist.github.com/bubnenkoff/4045c578497e9a9b108a7d62a8ae0ad5#file-foo-dart-L189 (same problem)