cripsy_binary_api/broker/
error.rs1use thiserror::Error;
4
5use crate::transport::error::TransportError;
6
7#[derive(Debug, Error)]
8pub enum BrokerError {
9 #[error("fallo de conexión: {0}")]
10 Connection(String),
11
12 #[error("autenticación fallida: {0}")]
13 Authentication(String),
14
15 #[error("timeout esperando respuesta del bróker")]
16 Timeout,
17
18 #[error("sin conexión con el bróker: la sesión no tiene socket operativo")]
23 NotConnected,
24
25 #[error("el bróker rechazó la operación: {0}")]
26 Rejected(String),
27
28 #[error("error de dominio: {0}")]
29 Domain(#[from] crate::domain::error::DomainError),
30
31 #[error("error de transporte: {0}")]
32 Transport(#[from] TransportError),
33
34 #[error("error interno: {0}")]
35 Internal(String),
36}
37
38impl BrokerError {
39 pub fn is_timeout(&self) -> bool {
41 matches!(self, BrokerError::Timeout)
42 }
43}