Dart Errors in multi-level asynchronous code
Uncaught asynchronous errors are handled to the current zone's error handler.What you are seeing is the root-zone's error handler reporting the error as uncaught, which also terminates the isolate.
What you want is to introduce a different error handler for your code, by running it through runZoned
with an error handler:
import "dart:async";main() { runZoned(() async { try { print("trying"); await doSomething(); print("success"); } catch (e) { print("caught"); } }, onError: (e, s) { print("uncaught"); });}