cortex_lang/interpreting/
error.rs

1use std::error::Error;
2
3use thiserror::Error;
4
5use super::value::CortexValue;
6
7pub type CortexError = Box<dyn Error>;
8
9#[derive(Error, Debug, PartialEq)]
10pub enum InterpreterError {
11    #[error("Program threw an error: {0}")]
12    ProgramThrow(CortexValue),
13    #[error("Parent environment does not exist")]
14    NoParentEnv,
15    #[error("Expected an integer value in this context; {0} is not an integer")]
16    ExpectedInteger(f64),
17    #[error("Bang operator called on a none value")]
18    BangCalledOnNoneValue,
19    #[error("Value not found: {0} (module constants are currently not supported)")]
20    ValueNotFound(String),
21    #[error("Mismatched type found: please run preprocessing on code before executing it")]
22    MismatchedTypeNoPreprocess,
23    #[error("Invalid {0} found: please run preprocessing on code before executing it")]
24    InvalidObject(&'static str),
25}