rlox_core/
error.rs

1use thiserror::Error;
2
3/// Top-level error type for the rlox workspace.
4///
5/// Each variant corresponds to a distinct subsystem. Callers can match
6/// on the variant to decide how to recover or propagate.
7#[derive(Debug, Error)]
8pub enum RloxError {
9    /// An action was invalid for the environment's action space.
10    #[error("Invalid action: {0}")]
11    InvalidAction(String),
12
13    /// An environment-level error (reset failure, physics divergence, etc.).
14    #[error("Environment error: {0}")]
15    EnvError(String),
16
17    /// A shape/dimension mismatch between expected and actual data.
18    #[error("Shape mismatch: expected {expected}, got {got}")]
19    ShapeMismatch { expected: String, got: String },
20
21    /// A replay-buffer or sampling error.
22    #[error("Buffer error: {0}")]
23    BufferError(String),
24
25    /// A neural-network or training-related error (e.g. Candle backend failures).
26    #[error("NN error: {0}")]
27    NNError(String),
28
29    /// An I/O error (file access, mmap, etc.).
30    #[error("I/O error: {0}")]
31    IoError(#[from] std::io::Error),
32}