1pub use sklears_core::error::{Result as SklResult, SklearsError};
4
5pub type Result<T> = std::result::Result<T, SklearsComposeError>;
7
8#[derive(Debug, thiserror::Error)]
10pub enum SklearsComposeError {
11 #[error(transparent)]
13 Core(#[from] SklearsError),
14
15 #[error("Invalid configuration: {0}")]
17 InvalidConfiguration(String),
18
19 #[error("Invalid data: {reason}")]
21 InvalidData { reason: String },
22
23 #[error("Invalid operation: {0}")]
25 InvalidOperation(String),
26
27 #[error("Serialization error: {0}")]
29 Serialization(String),
30
31 #[error("I/O error: {0}")]
33 Io(#[from] std::io::Error),
34
35 #[error("Error: {0}")]
37 Other(String),
38}
39
40impl From<String> for SklearsComposeError {
41 fn from(s: String) -> Self {
42 Self::Other(s)
43 }
44}
45
46impl From<&str> for SklearsComposeError {
47 fn from(s: &str) -> Self {
48 Self::Other(s.to_string())
49 }
50}