pub enum Error {
Show 29 variants
SyntaxError {
line: usize,
col: usize,
message: String,
},
ParseError(String),
UnexpectedEof,
UnexpectedToken {
expected: String,
got: String,
},
UndefinedVariable {
name: String,
},
UndefinedTool {
name: String,
},
TypeError {
expected: String,
got: String,
},
ConstantReassignment {
name: String,
},
DivisionByZero,
IndexOutOfBounds {
index: usize,
length: usize,
},
InvalidOperation {
op: String,
left_type: String,
right_type: String,
},
InvalidComparison {
left_type: String,
right_type: String,
},
NotCallable {
type_name: String,
},
EmptyCollection {
operation: String,
},
ToolExecutionError {
tool: String,
reason: String,
},
InvalidArguments {
tool: String,
reason: String,
},
NotImplemented {
tool: String,
},
Timeout(Duration),
OutOfMemory(usize),
ExecutionLimitExceeded {
limit: usize,
},
TooManyIterations {
limit: usize,
},
CircuitOpen,
InvalidBreak,
InvalidContinue,
RpcError {
message: String,
},
AiServiceError {
message: String,
},
NetworkError {
message: String,
},
NoTasksCompleted,
UserError(String),
}Expand description
OVSM interpreter errors
Variants§
SyntaxError
Syntax error encountered during parsing
Triggered by: Invalid OVSM syntax (missing keywords, malformed expressions)
Example: IF $x > 10 (missing THEN keyword)
Fields
ParseError(String)
General parse error
UnexpectedEof
Unexpected end of file during parsing
UnexpectedToken
Unexpected token encountered during parsing
UndefinedVariable
Reference to undefined variable
Triggered by: Using a variable before assignment
Example: RETURN $x (when $x was never assigned)
Prevention: Always initialize variables before use
UndefinedTool
Reference to undefined tool
TypeError
Type mismatch error
Triggered by: Operation expecting one type but receiving another
Example: $x = "hello" + 5 (string + number), IF "text" THEN (string as boolean)
Prevention: Ensure type compatibility in operations and conversions
ConstantReassignment
Attempt to reassign a constant value
DivisionByZero
Division by zero error
Triggered by: Dividing by zero or taking modulo of zero
Example: $x = 10 / 0, $y = 5 % 0
Prevention: Check denominator before division operations
IndexOutOfBounds
Array index out of bounds
Triggered by: Accessing array element beyond valid range
Example: $arr = [1, 2, 3]; $x = $arr[5] (index 5 when length is 3)
Prevention: Check array length before indexing, use LEN() tool
InvalidOperation
Invalid operation for given types
Triggered by: Performing unsupported operations on incompatible types
Example: [1,2] * "text" (array multiplication with string)
Prevention: Verify operand types support the intended operation
Fields
InvalidComparison
Invalid comparison between incompatible types
NotCallable
Attempt to call a non-callable value
EmptyCollection
Operation on empty collection that requires elements
ToolExecutionError
Tool execution failed
Triggered by: Runtime failure during tool execution
Example: POW(2, 1000000) (computation overflow), SQRT(-5) (negative sqrt)
Recovery: Classified as Recoverable - may be retried with different inputs
InvalidArguments
Invalid arguments provided to tool
NotImplemented
Tool not yet implemented
Timeout(Duration)
Operation timed out
OutOfMemory(usize)
Memory limit exceeded
ExecutionLimitExceeded
Execution limit exceeded
TooManyIterations
Too many loop iterations
CircuitOpen
Circuit breaker is open preventing operations
InvalidBreak
Break statement used outside of loop
InvalidContinue
Continue statement used outside of loop
RpcError
RPC call failed
AiServiceError
AI service error
NetworkError
Network operation failed
NoTasksCompleted
No parallel tasks completed successfully
UserError(String)
User-defined error