Skip to main content

Module errors

Module errors 

Source

Structs§

Diagnostic
A structured compile/runtime error, produced instead of printing + exiting whenever a diagnostic sink is installed (see collect_diagnostic).
ErrorCtx
What a runtime error report is built from: the source span of each instruction and the text of every source file. It borrows both from the program that runs, so starting a run costs no copy of either.
RuntimeError
A run-time error no try caught, as the VM hands it back to whoever ran the program.

Enums§

ErrType
Error types, largely borrowed from Rust

Constants§

BLUE
BOLD
BUILTIN_KINDS
Every kind a runtime error the language raises itself can carry: what ErrType::kind answers for each variant but Custom, whose kind is the one a throw names. Keep the two in step.
GREEN
RED
RESET

Functions§

blue
bold
call_site_name
The name a call site wrote for the function it calls: its source text up to the arguments. The VM holds no table of function names, so an error about a call reads the name back out of the source the call was compiled from.
collect_diagnostic
Runs f with a diagnostic sink installed.
crash
diagnostics_enabled
Whether errors should be recorded as a Diagnostic instead of being printed and aborting the process. This is what keeps the CLI behavior byte-for-byte identical: without an active sink, every error path behaves exactly as before.
emit_diagnostic
Records Diagnostic data in the active sink and unwinds to the enclosing collect_diagnostic call. Must only be called when diagnostics_enabled().
green
red
strip_ansi
Removes ANSI escape sequences (colors/bold) from an error message so that structured diagnostics carry plain text.
throw_compiler_error