24 lines
310 B
Plaintext
24 lines
310 B
Plaintext
module exceptions;
|
|
|
|
extern printf;
|
|
|
|
struct @MyException : @Exception {
|
|
|
|
};
|
|
|
|
@Void func throws ex [
|
|
throw new @MyException;
|
|
]
|
|
|
|
@Integer main [
|
|
try func();
|
|
catch (e) {
|
|
if (e::getType == "MyException") {
|
|
printf("MyException thrown!\n");
|
|
} else {
|
|
printf("Unhandled exception!\n");
|
|
}
|
|
}
|
|
return 0;
|
|
]
|