class

Crinja::Evaluator

Inherits Reference < Object

=== 1. Non-Crinja exceptions inside expressions get a node =================

Wrap at every evaluator visitor that can run code: the three that invoke user/builtin callables (filters, tests, functions) and the operator visitors — {{ total // per_page }} with a zero divisor, {{ big + 1 }} past Int64::MAX and {{ 2 ** 64 }} raise plain DivisionByZeroError / OverflowError and used to escape unlocated just like a filter's did. The wrapped error is a Crinja::RuntimeError, so the surrounding visit rescue (which only knows Crinja::Error) attaches the expression's location exactly as it does for Crinja's own errors, and every hwaro rescue site classifies it as HWARO_E_TEMPLATE with the source excerpt. Crinja errors pass through untouched — an inner wrap must not be re-wrapped by an outer filter expression.

The wrapper carries NO message of its own: SourceAttached#message already prints the cause as <Class>: <message> when the message is nil, whereas a message plus a cause printed the same text twice (Division by 0 (DivisionByZeroError) / cause: Division by 0).

Instance methods

evaluate(expression : AST::ConditionalExpression)
Source
evaluate(expression : AST::SliceExpression)
Source