Qu

error

Builtin index · REPL & diagnostics

error(msg)

Input: msg · Output: no output

What it is

Takes one argument, msg (a string, typically built with {...} interpolation), and raises an EvalError carrying that message. Never returns normally — control passes to the nearest enclosing try/catch, where the caught exception object exposes the string as .message; uncaught, it aborts the script.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
error(msg)
msg stringnot documented yet
no outputNever returns normally — control passes to the nearest enclosing try/catch, where the caught exception object exposes the string as .message; uncaught, it aborts the script.

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

function test_sum()
  if sum([1, 2, 3]) != 6
    error("sum([1,2,3]) was not 6")
  end if
end function

from quickstart

How it works

error(msg) raises — an ordinary EvalError, catchable by an enclosing try/catch (§18.B). warn(msg) is non-fatal.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.