Skip to main content

intent_runtime/
error.rs

1use thiserror::Error;
2
3/// Errors that can occur during expression evaluation.
4#[derive(Debug, Error, PartialEq)]
5pub enum RuntimeError {
6    #[error("unbound variable: {0}")]
7    UnboundVariable(String),
8
9    #[error("field '{field}' not found on value")]
10    FieldNotFound { field: String },
11
12    #[error("field access on non-object value")]
13    NotAnObject,
14
15    #[error("type error: expected {expected}, got {got}")]
16    TypeError { expected: String, got: String },
17
18    #[error("old() used outside postcondition context")]
19    OldWithoutContext,
20
21    #[error("no instances provided for type '{0}' in quantifier")]
22    NoInstances(String),
23
24    #[error("division by zero")]
25    DivisionByZero,
26
27    #[error("unknown function: {0}")]
28    UnknownFunction(String),
29
30    #[error("decimal arithmetic error: {0}")]
31    DecimalError(String),
32}