Skip to main content

talos_api_rs/error/
mod.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2
3use thiserror::Error;
4
5#[allow(clippy::result_large_err)]
6#[derive(Debug, Error)]
7pub enum TalosError {
8    #[error("Configuration error: {0}")]
9    Config(String),
10
11    #[error("API request failed: {0}")]
12    Api(#[from] tonic::Status),
13
14    #[error("Transport error: {0}")]
15    Transport(#[from] tonic::transport::Error),
16
17    #[error("Validation error: {0}")]
18    Validation(String),
19
20    #[error("Connection error: {0}")]
21    Connection(String),
22
23    #[error("Circuit breaker is open: {0}")]
24    CircuitOpen(String),
25
26    #[error("Unknown error: {0}")]
27    Unknown(String),
28}
29
30pub type Result<T> = std::result::Result<T, TalosError>;