marioreggiori / objectdb

Persistent embedded document-oriented NoSQL database for Dart and Flutter.
https://pub.dev/packages/objectdb
MIT License
190 stars 21 forks source link

accept null values as valid types and enhanced exception handling #41

Closed fhuonder closed 4 years ago

fhuonder commented 4 years ago

Fix for https://github.com/marioreggiori/objectdb/issues/40

In order to properly propagate the exception out of the open()-method a change to the execution_queue-library would be necessary. The change would be to change

item.completer.complete(await item.job());

to

try {
    var result = await item.job();
    item.completer.complete(result);
}catch(e){
    item.completer.completeError(e);
}

This is needed that the error of the job is propagated. Otherwise this leads to an "Unhandled exception" exception.