use thiserror::Error;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Error, Debug)]
pub enum Error {
#[error("AMQP error: {0}")]
Amqp(String),
#[error("Stream protocol error: {0}")]
Stream(String),
#[error("Management API error: {0}")]
ManagementApi(String),
#[error("Storage error: {0}")]
Storage(String),
#[error("Configuration error: {0}")]
Config(String),
#[error("Serialization error: {0}")]
Serialization(String),
#[error("Checkpoint error: {0}")]
Checkpoint(String),
#[error("Compression error: {0}")]
Compression(String),
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("Connection error: {0}")]
Connection(String),
#[error("Authentication error: {0}")]
Authentication(String),
#[error("Manifest error: {0}")]
Manifest(String),
}
impl From<serde_json::Error> for Error {
fn from(err: serde_json::Error) -> Self {
Error::Serialization(err.to_string())
}
}
impl From<serde_yaml::Error> for Error {
fn from(err: serde_yaml::Error) -> Self {
Error::Serialization(err.to_string())
}
}
impl From<sqlx::Error> for Error {
fn from(err: sqlx::Error) -> Self {
Error::Checkpoint(err.to_string())
}
}