Monkey Documentation

Class Throwable

The Throwable class must be extended by all classes that are intended to be used with Throw. More...


Extended by:

Detailed Discussion

The Throwable class must be extended by all classes that are intended to be used with Throw.

The Throwable class currently has no members.

Any attempt to throw an object that doesn't extend Throwable will result in a compile time error.

Example

Class MyThrowable Extends Throwable

    Field msg:String
    
    Method Newmsg:String )
        Self.msg=msg
    End
End

Function Test:Void()
    Throw New MyThrowable"Thrown!" )
End

Function Main()
    Try
        Test
    Catch t:MyThrowable
        Print "MyThrowable thrown: msg="+t.msg
    End
End