pub enum Error {
LexerError {
line: usize,
column: usize,
message: String,
},
ParseError {
line: usize,
message: String,
},
RuntimeError {
message: String,
stack_trace: Option<Vec<String>>,
},
UndefinedVariable {
name: String,
},
UndefinedFunction {
name: String,
},
TypeError {
expected: String,
actual: String,
},
ArgumentError {
expected: usize,
actual: usize,
},
IoError(Error),
NetworkError(String),
AiError(String),
JsonError(Error),
InternalError(String),
}Expand description
Comprehensive error type for all OpenScript operations
Variants§
LexerError
Lexical analysis errors
Fields
ParseError
Parser errors
RuntimeError
Runtime execution errors
UndefinedVariable
Variable not found
UndefinedFunction
Function not found
TypeError
Type mismatch errors
ArgumentError
Argument count mismatch
IoError(Error)
IO errors
NetworkError(String)
Network/HTTP errors
AiError(String)
AI service errors
JsonError(Error)
JSON parsing errors
InternalError(String)
Generic errors
Implementations§
Source§impl Error
impl Error
Sourcepub fn lexer_error(
line: usize,
column: usize,
message: impl Into<String>,
) -> Self
pub fn lexer_error( line: usize, column: usize, message: impl Into<String>, ) -> Self
Create a new lexer error
Sourcepub fn parse_error(line: usize, message: impl Into<String>) -> Self
pub fn parse_error(line: usize, message: impl Into<String>) -> Self
Create a new parse error
Sourcepub fn runtime_error(message: impl Into<String>) -> Self
pub fn runtime_error(message: impl Into<String>) -> Self
Create a new runtime error
Sourcepub fn runtime_error_with_trace(
message: impl Into<String>,
stack_trace: Vec<String>,
) -> Self
pub fn runtime_error_with_trace( message: impl Into<String>, stack_trace: Vec<String>, ) -> Self
Create a new runtime error with stack trace
Sourcepub fn undefined_variable(name: impl Into<String>) -> Self
pub fn undefined_variable(name: impl Into<String>) -> Self
Create a new undefined variable error
Sourcepub fn undefined_function(name: impl Into<String>) -> Self
pub fn undefined_function(name: impl Into<String>) -> Self
Create a new undefined function error
Sourcepub fn type_error(
expected: impl Into<String>,
actual: impl Into<String>,
) -> Self
pub fn type_error( expected: impl Into<String>, actual: impl Into<String>, ) -> Self
Create a new type error
Sourcepub fn argument_error(expected: usize, actual: usize) -> Self
pub fn argument_error(expected: usize, actual: usize) -> Self
Create a new argument error
Sourcepub fn network_error(message: impl Into<String>) -> Self
pub fn network_error(message: impl Into<String>) -> Self
Create a new network error
Sourcepub fn internal_error(message: impl Into<String>) -> Self
pub fn internal_error(message: impl Into<String>) -> Self
Create a new internal error
Sourcepub fn is_recoverable(&self) -> bool
pub fn is_recoverable(&self) -> bool
Check if this is a recoverable error
Sourcepub fn severity(&self) -> ErrorSeverity
pub fn severity(&self) -> ErrorSeverity
Get error severity level
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more