1use crate::ast::HistoryIndexKind;
2
3#[derive(Debug, thiserror::Error)]
4pub enum ArithmeticError {
5 #[error("overflow")]
6 Overflow,
7 #[error("underflow")]
8 Underflow,
9 #[error("attempt to divide by 0")]
10 DivideBy0,
11}
12
13#[derive(Debug, thiserror::Error)]
14pub enum Error {
15 #[error(transparent)]
16 Arithmetic(#[from] ArithmeticError),
17 #[error("parsing: {0}")]
18 Parse(#[from] ParseValueError),
19 #[error("{0:?} history index {1} out of bounds: [0..{2})")]
20 HistoryOOB(HistoryIndexKind, usize, usize),
21 #[error("attempted to perform an operation which only makes sense for integers, but value is currently a float")]
22 ImproperlyFloat,
23}
24
25#[derive(Debug, thiserror::Error)]
26pub enum ParseValueError {
27 #[error("\"{0}\" cannot be parsed as Value")]
28 Simple(String),
29 #[error("\"{0}\" cannot be parsed as Value given radix {1}")]
30 Radix(String, u32),
31}