pub enum ParserError {
SyntaxError {
message: String,
position: SourcePosition,
expected: Option<Vec<String>>,
},
SemanticError {
message: String,
position: Option<SourcePosition>,
},
LexicalError {
message: String,
position: SourcePosition,
},
BackendError {
backend: String,
message: String,
position: Option<SourcePosition>,
},
TypeError {
message: String,
expected_type: Option<String>,
actual_type: Option<String>,
position: Option<SourcePosition>,
},
ConfigurationError {
message: String,
},
UnsupportedFeature {
backend: String,
feature: String,
message: String,
},
Timeout {
message: String,
timeout_duration: Duration,
},
ResourceLimit {
message: String,
limit_type: String,
current_value: u64,
max_value: u64,
},
InternalError {
message: String,
cause: Option<String>,
},
}Expand description
Parser-specific error type
Variants§
SyntaxError
Syntax error during parsing
SemanticError
Semantic validation error
LexicalError
Lexical analysis error
BackendError
Parser backend error
TypeError
Type validation error
Fields
position: Option<SourcePosition>ConfigurationError
Configuration error
UnsupportedFeature
Unsupported feature error
Timeout
Timeout error
ResourceLimit
Resource limit exceeded
InternalError
Internal parser error
Implementations§
Source§impl ParserError
impl ParserError
Sourcepub fn syntax(message: impl Into<String>, position: SourcePosition) -> Self
pub fn syntax(message: impl Into<String>, position: SourcePosition) -> Self
Create a syntax error
Sourcepub fn syntax_with_expected(
message: impl Into<String>,
position: SourcePosition,
expected: Vec<String>,
) -> Self
pub fn syntax_with_expected( message: impl Into<String>, position: SourcePosition, expected: Vec<String>, ) -> Self
Create a syntax error with expected tokens
Sourcepub fn semantic_at(message: impl Into<String>, position: SourcePosition) -> Self
pub fn semantic_at(message: impl Into<String>, position: SourcePosition) -> Self
Create a semantic error with position
Sourcepub fn lexical(message: impl Into<String>, position: SourcePosition) -> Self
pub fn lexical(message: impl Into<String>, position: SourcePosition) -> Self
Create a lexical error
Sourcepub fn backend(backend: impl Into<String>, message: impl Into<String>) -> Self
pub fn backend(backend: impl Into<String>, message: impl Into<String>) -> Self
Create a backend error
Sourcepub fn backend_at(
backend: impl Into<String>,
message: impl Into<String>,
position: SourcePosition,
) -> Self
pub fn backend_at( backend: impl Into<String>, message: impl Into<String>, position: SourcePosition, ) -> Self
Create a backend error with position
Sourcepub fn type_error(message: impl Into<String>) -> Self
pub fn type_error(message: impl Into<String>) -> Self
Create a type error
Sourcepub fn type_mismatch(
expected: impl Into<String>,
actual: impl Into<String>,
position: Option<SourcePosition>,
) -> Self
pub fn type_mismatch( expected: impl Into<String>, actual: impl Into<String>, position: Option<SourcePosition>, ) -> Self
Create a type error with expected and actual types
Sourcepub fn configuration(message: impl Into<String>) -> Self
pub fn configuration(message: impl Into<String>) -> Self
Create a configuration error
Sourcepub fn unsupported_feature(
backend: impl Into<String>,
feature: impl Into<String>,
) -> Self
pub fn unsupported_feature( backend: impl Into<String>, feature: impl Into<String>, ) -> Self
Create an unsupported feature error
Sourcepub fn internal_with_cause(
message: impl Into<String>,
cause: impl Display,
) -> Self
pub fn internal_with_cause( message: impl Into<String>, cause: impl Display, ) -> Self
Create an internal error with cause
Sourcepub fn resource_limit(
resource: impl Into<String>,
limit: u64,
actual: u64,
) -> Self
pub fn resource_limit( resource: impl Into<String>, limit: u64, actual: u64, ) -> Self
Create a resource limit exceeded error
Sourcepub fn position(&self) -> Option<&SourcePosition>
pub fn position(&self) -> Option<&SourcePosition>
Get the position associated with this error (if any)
Sourcepub fn is_recoverable(&self) -> bool
pub fn is_recoverable(&self) -> bool
Check if this error is recoverable.
Recoverable errors include those where switching backends, retrying with a longer timeout, or raising a resource limit may allow progress.
Sourcepub fn category(&self) -> &ErrorCategory
pub fn category(&self) -> &ErrorCategory
Get the error category
Sourcepub fn severity(&self) -> &ErrorSeverity
pub fn severity(&self) -> &ErrorSeverity
Get the error severity
Sourcepub fn recovery_suggestions(&self) -> Vec<String>
pub fn recovery_suggestions(&self) -> Vec<String>
Get suggested recovery actions
Trait Implementations§
Source§impl Clone for ParserError
impl Clone for ParserError
Source§fn clone(&self) -> ParserError
fn clone(&self) -> ParserError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParserError
impl Debug for ParserError
Source§impl Display for ParserError
impl Display for ParserError
Source§impl Error for ParserError
impl Error for ParserError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()