Expand description
Error types and error reporting for AgentScript.
This module provides structured error types and pretty error reporting using the ariadne crate for colorful, context-aware error messages.
§Error Types
AgentScriptError- Main error enum for parse and validation errorsParseErrorInfo- Details about parse failuresValidationError- Semantic validation errors
§Pretty Printing
Use ErrorReporter for user-friendly error output:
use busbar_sf_agentscript::error::{ErrorReporter, ParseErrorInfo};
let source = "config:\n agent_name: bad";
let reporter = ErrorReporter::new("example.agent", source);
// Create and report an error
let error = ParseErrorInfo {
message: "Expected string literal".to_string(),
span: Some(18..21),
expected: vec!["string".to_string()],
found: Some("identifier".to_string()),
contexts: vec![],
};
// reporter.report_parse_error(&error); // Prints colorful errorStructs§
- Error
Reporter - Error reporter that uses ariadne for pretty error output.
- Parse
Error Info - Information about a parse error.
- Validation
Error - Validation error for semantic issues.
Enums§
- Agent
Script Error - The main error type for AgentScript operations.
Type Aliases§
- Result
- Result type for AgentScript operations.