use thiserror::Error; #[derive(Error, Debug, Clone)] pub enum RLError { #[error("Tensor operation error: {0}")] TensorError(String), #[error("Environment error: {0}")] EnvironmentError(String), #[error("Replay buffer error: {0}")] ReplayBufferError(String), #[error("Algorithm error: {0}")] AlgorithmError(String), #[error("Actor-Learner error: {0}")] ActorLearnerError(String), #[error("Insufficient data: required {required}, available {available}")] InsufficientData { required: usize, available: usize }, #[error("Invalid configuration: {0}")] InvalidConfig(String), #[error("Communication error: {0}")] CommunicationError(String), #[error("Serialization error: {0}")] SerializationError(String), } impl From for RLError { fn from(err: rtx_tensor::TensorError) -> Self { Self::TensorError(err.to_string()) } } // impl From for RLError { // fn from(err: rtx_runtime::RuntimeError) -> Self { // RLError::TensorError(err.to_string()) // } // } // impl From for RLError { // fn from(err: rtx_distributed::DistributedError) -> Self { // RLError::CommunicationError(err.to_string()) // } // } pub type Result = std::result::Result;