1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("Database error: {0}")]
Database(String),
#[error("Secret error: {0}")]
Secret(String),
#[error("Panic occurred in shuttle_service::main`: {0}")]
BuildPanic(String),
#[error("Panic occurred in `Service::bind`: {0}")]
BindPanic(String),
#[error("Custom error: {0}")]
Custom(#[from] CustomError),
}
pub type CustomError = anyhow::Error;
#[cfg(feature = "mongodb-integration")]
impl From<mongodb::error::Error> for Error {
fn from(e: mongodb::error::Error) -> Self {
Error::Database(e.to_string())
}
}