2023-09-23 18:21:39 +02:00
|
|
|
use thiserror::Error;
|
|
|
|
|
|
|
|
#[derive(Error, Debug)]
|
|
|
|
pub enum SerializeError {
|
|
|
|
#[error("failed to serialize {0}")]
|
|
|
|
FailedToSerialize(anyhow::Error),
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Error, Debug)]
|
|
|
|
pub enum DeserializeError {
|
|
|
|
#[error("failed to serialize {0}")]
|
|
|
|
FailedToDeserialize(anyhow::Error),
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Error, Debug)]
|
|
|
|
pub enum PublishError {
|
|
|
|
#[error("failed to serialize {0}")]
|
|
|
|
SerializeError(#[source] SerializeError),
|
|
|
|
|
|
|
|
#[error("failed to commit to database {0}")]
|
|
|
|
DbError(#[source] anyhow::Error),
|
|
|
|
|
|
|
|
#[error("transaction failed {0}")]
|
|
|
|
DbTxError(#[source] anyhow::Error),
|
|
|
|
|
|
|
|
#[error("failed to connect to database {0}")]
|
|
|
|
ConnectionError(#[source] anyhow::Error),
|
|
|
|
}
|
|
|
|
|
2023-09-23 22:38:12 +02:00
|
|
|
#[derive(Error, Debug)]
|
|
|
|
pub enum SubscriptionError {
|
|
|
|
#[error("failed to subscribe: {0}")]
|
|
|
|
FailedToSubscribe(#[source] anyhow::Error),
|
|
|
|
|
|
|
|
#[error("connection failed: {0}")]
|
|
|
|
ConnectionFailed(#[source] TransportError),
|
|
|
|
|
|
|
|
#[error("failed to deserialize{0}")]
|
|
|
|
DeserializationFailed(#[source] DeserializeError),
|
|
|
|
}
|
|
|
|
|
2023-09-23 18:21:39 +02:00
|
|
|
#[derive(Error, Debug)]
|
|
|
|
pub enum TransportError {
|
|
|
|
#[error("to publish to transport {0}")]
|
|
|
|
Err(anyhow::Error),
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Error, Debug)]
|
|
|
|
pub enum PersistenceError {
|
|
|
|
#[error("failed to get item {0}")]
|
|
|
|
GetErr(anyhow::Error),
|
|
|
|
|
|
|
|
#[error("failed to publish item {0}")]
|
|
|
|
UpdatePublished(anyhow::Error),
|
|
|
|
}
|
2023-09-24 00:00:41 +02:00
|
|
|
|
|
|
|
#[derive(Error, Debug)]
|
|
|
|
pub enum BuilderError {
|
|
|
|
#[error("dependency not added to builder: {0}")]
|
|
|
|
DependencyError(anyhow::Error),
|
|
|
|
}
|