LEVIATHAN v962456e · 962456eee1

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 message

The text that describes what went wrong.

Methods

toString

toString() -> string

Returns 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.