Skip to content

Instantly share code, notes, and snippets.

@jeovazero
Created March 6, 2021 10:27
Show Gist options
  • Save jeovazero/0734aa7f261d184318f5e4d99c0028c5 to your computer and use it in GitHub Desktop.
Save jeovazero/0734aa7f261d184318f5e4d99c0028c5 to your computer and use it in GitHub Desktop.
// jeotario's academy
void exceptional() {
throw Exception('hi');
}
void hello() {
throw 'Hello Friend';
}
void err() {
throw Error();
}
void unimplemented() {
throw UnimplementedError();
}
void myException() {
throw MyException(2, 'hi exception');
}
class MyException implements Exception {
int line;
String msg;
MyException(this.line, this.msg);
}
void main() {
try {
myException();
} on MyException catch (e) {
print('line ${e.line} msg ${e.msg}');
rethrow;
} catch (e) {
print('err');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment