rabbitmq_backup_core/
error.rs1use thiserror::Error;
4
5pub type Result<T> = std::result::Result<T, Error>;
7
8#[derive(Error, Debug)]
10pub enum Error {
11 #[error("AMQP error: {0}")]
13 Amqp(String),
14
15 #[error("Stream protocol error: {0}")]
17 Stream(String),
18
19 #[error("Management API error: {0}")]
21 ManagementApi(String),
22
23 #[error("Storage error: {0}")]
25 Storage(String),
26
27 #[error("Configuration error: {0}")]
29 Config(String),
30
31 #[error("Serialization error: {0}")]
33 Serialization(String),
34
35 #[error("Checkpoint error: {0}")]
37 Checkpoint(String),
38
39 #[error("Compression error: {0}")]
41 Compression(String),
42
43 #[error("IO error: {0}")]
45 Io(#[from] std::io::Error),
46
47 #[error("Connection error: {0}")]
49 Connection(String),
50
51 #[error("Authentication error: {0}")]
53 Authentication(String),
54
55 #[error("Manifest error: {0}")]
57 Manifest(String),
58}
59
60impl From<serde_json::Error> for Error {
61 fn from(err: serde_json::Error) -> Self {
62 Error::Serialization(err.to_string())
63 }
64}
65
66impl From<serde_yaml::Error> for Error {
67 fn from(err: serde_yaml::Error) -> Self {
68 Error::Serialization(err.to_string())
69 }
70}
71
72impl From<sqlx::Error> for Error {
73 fn from(err: sqlx::Error) -> Self {
74 Error::Checkpoint(err.to_string())
75 }
76}