Skip to main content

Module diagnostic

Module diagnostic 

Source
Expand description

Structured diagnostics for the .rag language and a source-aware renderer.

A Diagnostic is the structured form of a language error: a Severity, a headline message, a primary Span (optionally labelled), zero or more labelled secondary spans, and an optional help line. The renderer turns a diagnostic plus the originating SourceFile into the familiar caret-underline presentation:

error[E-rag-unknown-node]: route target `toolz` does not exist
  --> support.rag:11:20
   |
11 |       tool_call -> toolz
   |                    ^^^^^ unknown node
   |
help: did you mean `tools`?

Diagnostics keep their structure all the way to the crate boundary: the lexer and parser build a Diagnostic, then fold it into a crate::error::TinyAgentsError::Parse through Diagnostic::into_parse_error, which preserves the primary span’s line/column in the error variant and stores the rendered presentation as the error message.

Structs§

Diagnostic
A structured language diagnostic.
Label
A labelled secondary span attached to a Diagnostic.

Enums§

Severity
The severity of a Diagnostic.