Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/Exceptions/Nemerle/exceptions.nemerle
Normal file
23
Task/Exceptions/Nemerle/exceptions.nemerle
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// define a new exception
|
||||
class MyException : Exception
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
// throw an exception
|
||||
Foo() : void
|
||||
{
|
||||
throw MyException();
|
||||
}
|
||||
|
||||
// catching exceptions
|
||||
try {
|
||||
Foo();
|
||||
}
|
||||
catch { // catch block uses pattern matching syntax
|
||||
|e is MyException => ... // handle exception
|
||||
|_ => throw e // rethrow unhandled exception
|
||||
}
|
||||
finally {
|
||||
... // code executes whether or not exception was thrown
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue