Standard Library
interface IException
The interface that every thrown value must implement.
since 0.1.0-alpha.1linuxwindowswasm
Overview
It requires a message and a toString(). Catching IException handles every kind of error, including ones from other libraries. Most code throws or catches the ready-made classes RuntimeException, LogicException and FileException, or derives its own from Exception.
Examples
try {
throw RuntimeException("something failed");
} catch (IException e) {
console.writeln(e.message);
}
something failed
Fields
message
string messageThe text that describes what went wrong.
Methods
toString
toString() -> stringReturns the text of the error.
Returns
Normally the message.
Examples
IException e = Exception("disk full");
console.writeln(e.toString());
disk full
See also
- Exception — The base class of the standard exceptions, holding a message.
- RuntimeException — The error the standard library throws when an operation fails at run time.