Language reference

Errors and exceptions

Catch runtime errors, inspect identifiers, and rethrow deliberately.

01

Handle a runtime error

Syntax and lexer errors occur before execution and cannot be caught. Runtime effects completed before an error are not rolled back.

Sun
try
    result = inv([1, 2; 2, 4]);
catch failure
    disp(failure.identifier);
    disp(failure.message);
end
02

Raise and rethrow

Sun
try
    error("Plant:PressureHigh", "Pressure exceeded the limit");
catch failure
    rethrow(failure);
end
03

Current limits

Exception values expose read-only identifier and message fields. Stack traces, causes, finally, and native exception handling are not implemented.