Skip to main content

Module error

Module error 

Source
Expand description

Error and diagnostic system for the Orrery parser.

This module provides an error handling system with:

  • Error codes for documentation and searchability
  • Multiple labeled spans for rich error context
  • Severity levels
  • Diagnostic collector for accumulating multiple errors

§Overview

The error system is built around the Diagnostic type, which represents a single error or warning message with optional error code, multiple source locations, and help text. Multiple diagnostics are wrapped in ParseError for returning from the parsing lifecycle.

§Example


let span = Span::new(100..120);
let original_span = Span::new(50..70);

let diag = Diagnostic::error("cannot override built-in type `Component`")
    .with_code(ErrorCode::E301)
    .with_label(span, "type override not supported")
    .with_help("built-in types cannot be redefined");

Structs§

Diagnostic
A rich diagnostic message with source location information.
Label
A labeled span in source code.
ParseError
Error type for the parsing lifecycle.
SourceError
Error returned by SourceProvider operations.

Enums§

ErrorCode
Error codes for categorizing diagnostic errors.
Severity
The severity level of a diagnostic.