1use crate::var::Var;
3use thiserror::Error;
4
5#[derive(Error, Debug)]
7pub enum Error {
8 #[error("node is not present in this `Context`")]
10 BadNode,
11
12 #[error("variable is not present in this `Context`")]
14 BadVar,
15
16 #[error("variable {0} is missing in the evaluation map")]
18 MissingVar(Var),
19
20 #[error("node does not have an associated variable")]
22 NotAVar,
23
24 #[error("node is not a constant")]
26 NotAConst,
27
28 #[error("`Context` is empty")]
30 EmptyContext,
31
32 #[error("`IndexMap` is empty")]
34 EmptyMap,
35
36 #[error("unknown opcode {0}")]
38 UnknownOpcode(String),
39
40 #[error("unknown variable {0}")]
42 UnknownVariable(String),
43
44 #[error("empty file")]
46 EmptyFile,
47
48 #[error("choice slice length ({0}) does not match choice count ({1})")]
50 BadChoiceSlice(usize, usize),
51
52 #[error("variable slice lengths are mismatched")]
54 MismatchedSlices,
55
56 #[error("variable slice length ({0}) does not match expected count ({1})")]
58 BadVarSlice(usize, usize),
59
60 #[error("variable index ({0}) exceeds max var index for this tape ({1})")]
62 BadVarIndex(usize, usize),
63
64 #[error("could not solve for matrix pseudo-inverse: {0}")]
66 SingularMatrix(&'static str),
67
68 #[error("io error: {0}")]
70 IoError(#[from] std::io::Error),
71
72 #[error("bad tile sizes; {0} is not divisible by {1}")]
74 BadTileSize(usize, usize),
75
76 #[error("bad tile order; {0} is not larger than {1}")]
78 BadTileOrder(usize, usize),
79
80 #[error("tile size list must not be empty")]
82 EmptyTileSizes,
83}