Files
telemetry_visualization/api/src/client/error.rs
2026-01-01 12:13:05 -05:00

38 lines
1.1 KiB
Rust

use api_core::data_type::DataType;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum ConnectError {
#[error(transparent)]
TungsteniteError(#[from] tokio_tungstenite::tungstenite::Error),
#[error(transparent)]
IoError(#[from] std::io::Error),
}
#[derive(Error, Debug)]
pub enum MessageError {
#[error(transparent)]
TokioSendError(#[from] tokio::sync::mpsc::error::SendError<()>),
#[error(transparent)]
TokioTrySendError(#[from] tokio::sync::mpsc::error::TrySendError<()>),
#[error(transparent)]
TokioLockError(#[from] tokio::sync::TryLockError),
#[error("Incorrect Data Type. {expected} expected. {actual} actual.")]
IncorrectDataType {
expected: DataType,
actual: DataType,
},
}
#[derive(Error, Debug)]
pub enum RequestError<E> {
#[error(transparent)]
TokioSendError(#[from] tokio::sync::mpsc::error::SendError<()>),
#[error(transparent)]
TokioLockError(#[from] tokio::sync::TryLockError),
#[error(transparent)]
RecvError(#[from] tokio::sync::oneshot::error::RecvError),
#[error(transparent)]
Inner(E),
}