- try
- catch
Catch exception
examples/dart-intro/catch_exception.dart
div(x, y) { return x ~/ y; } main() { try { print(div(2, 1)); print(div(1, 0)); print(div(3, 1)); } catch(exception, stackTrace) { print(exception); print(stackTrace); } print("still working"); }
2 IntegerDivisionByZeroException #0 int.~/ (dart:core-patch/integers.dart:26) #1 div (file:///.../dart/examples/intro/catch_exception.dart:2:12) #2 main (file:///.../dart/examples/intro/catch_exception.dart:10:14) #3 _startIsolate.isolateStartHandler (dart:isolate-patch/isolate_patch.dart:216) #4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:115) still working