Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/Exceptions/Fantom/exceptions.fantom
Normal file
23
Task/Exceptions/Fantom/exceptions.fantom
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// Create a new error class by subclassing sys::Err
|
||||
const class SpecialErr : Err
|
||||
{
|
||||
// you must provide some message about the error
|
||||
// to the parent class, for reporting
|
||||
new make () : super ("special error") {}
|
||||
}
|
||||
|
||||
class Main
|
||||
{
|
||||
static Void fn ()
|
||||
{
|
||||
throw SpecialErr ()
|
||||
}
|
||||
|
||||
public static Void main ()
|
||||
{
|
||||
try
|
||||
fn()
|
||||
catch (SpecialErr e)
|
||||
echo ("Caught " + e)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue