Core feature

Errors & source spans

Make invalid input useful with stable error codes, exact spans, and phase-aware exceptions.

← All documentation

Failures you can design around.

Lexing, parsing, and evaluation errors are represented by MathException subclasses. Every expression error carries a stable code and a source span so your form can underline the exact problem.

lex.malformed_numberInvalid numeric token
parse.unexpected_tokenExpression structure is invalid
eval.division_by_zeroDivision or modulo by zero
eval.integer_overflowExact integer result cannot fit