1use thiserror::Error;
2
3#[derive(Debug, Error)]
8pub enum RloxError {
9 #[error("Invalid action: {0}")]
11 InvalidAction(String),
12
13 #[error("Environment error: {0}")]
15 EnvError(String),
16
17 #[error("Shape mismatch: expected {expected}, got {got}")]
19 ShapeMismatch { expected: String, got: String },
20
21 #[error("Buffer error: {0}")]
23 BufferError(String),
24
25 #[error("NN error: {0}")]
27 NNError(String),
28
29 #[error("I/O error: {0}")]
31 IoError(#[from] std::io::Error),
32}
33
34impl From<rlox_rl_ops::RlOpsError> for RloxError {
35 fn from(e: rlox_rl_ops::RlOpsError) -> Self {
36 match e {
37 rlox_rl_ops::RlOpsError::ShapeMismatch { expected, got } => {
38 RloxError::ShapeMismatch { expected, got }
39 }
40 }
41 }
42}