Created
October 18, 2021 11:23
-
-
Save s0nerik/2f561d5246ac625b519d526a12b30690 to your computer and use it in GitHub Desktop.
Dart async error catch example (WRONG, doesn't capture expection)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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