shuttle_service/
error.rs

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
//! Types representing various errors that can occur in the process of building and deploying a service.

use thiserror::Error;

/// An error that can occur in the process of building and deploying a service.
#[derive(Debug, Error)]
pub enum Error {
    /// An Input/Output error.
    #[error("IO error: {0}")]
    Io(#[from] std::io::Error),
    /// An Error related to the database.
    #[error("Database error: {0}")]
    Database(String),
    /// An error related to the build process.
    #[error("Panic occurred in shuttle_service::main`: {0}")]
    BuildPanic(String),
    /// An error related to the bind process.
    #[error("Panic occurred in `Service::bind`: {0}")]
    BindPanic(String),
    /// An error related to parsing the Secrets.toml file.
    #[error("Failed to interpolate string. Is your Secrets.toml correct?")]
    StringInterpolation(#[from] strfmt::FmtError),
    #[error(transparent)]
    Custom(#[from] CustomError),
}

/// Type alias for an `anyhow::Error`.
pub type CustomError = anyhow::Error;