Skip to content

Instantly share code, notes, and snippets.

@s0nerik
Created October 18, 2021 11:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s0nerik/2f561d5246ac625b519d526a12b30690 to your computer and use it in GitHub Desktop.
Save s0nerik/2f561d5246ac625b519d526a12b30690 to your computer and use it in GitHub Desktop.
Dart async error catch example (WRONG, doesn't capture expection)
Future<void> main() async {
await test();
}
Future<void> test() async {
try {
return errorGenerator();
} catch (e) {
print('!!!CAPTURED ERROR!!!');
} finally {
print('!!!FINALLY!!!');
}
}
Future<void> errorGenerator() async {
throw Exception('hello');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment