Skip to main content

fx_utils/
error.rs

1//! Error types and result aliases for the FX eTrading platform
2
3use thiserror::Error;
4
5/// Common error types used across the platform
6#[derive(Error, Debug)]
7pub enum Error {
8    #[error("Invalid input: {0}")]
9    InvalidInput(String),
10
11    #[error("IO error: {0}")]
12    Io(#[from] std::io::Error),
13
14    #[error("Serialization error: {0}")]
15    Serialization(String),
16
17    #[error("Network error: {0}")]
18    Network(String),
19
20    #[error("Service unavailable: {0}")]
21    ServiceUnavailable(String),
22
23    #[error("Internal error: {0}")]
24    Internal(String),
25
26    #[error("Prometheus error: {0}")]
27    Prometheus(String),
28}
29
30/// Result type alias using the platform error type
31pub type Result<T> = std::result::Result<T, Error>;