Standard Library
class RuntimeException
The error the standard library throws when an operation fails at run time.
since 0.1.0-alpha.1linuxwindowswasm
- bases
Exception,IRuntimeException
Overview
Examples are a value out of range, converting text that is not a number, or a connection that cannot be opened. message describes the failure. Throw it for the same kind of failure in your own code.
Examples
try {
throw RuntimeException("boom");
} catch (LogicException e) {
console.writeln("logic");
} catch (RuntimeException e) {
console.writeln("runtime: ${e.message}");
}
runtime: boom
Constructors
new
new(string msg)Creates a runtime error with a message.
Parameters
- msg
- The text describing what went wrong.
Examples
RuntimeException e = RuntimeException("bad input");
console.writeln(e.message);
bad input
See also
- IRuntimeException — The interface of errors that arise while a program runs, such as a bad argument or a failed operation.
- LogicException — An error that signals a mistake in the program's own logic, such as using an object in the wrong state.