fly/
error.rs

1use thiserror::Error;
2
3pub(crate) type Result<T> = core::result::Result<T, Error>;
4
5#[derive(Error, Debug)]
6pub enum Error {
7    #[error(transparent)]
8    Pg(#[from] postgres::Error),
9    #[error(transparent)]
10    Io(#[from] std::io::Error),
11    #[error("required environment variable {name} not set")]
12    MissingEnv { name: String },
13    #[error("environment variable {name} could not be parsed")]
14    BadEnvFormat { name: String },
15    #[error("no filename given")]
16    FilenameRequired,
17    #[error("filename must be utf-8 encoded")]
18    FilenameBadEncoding,
19    #[error("bad migration file format in {name}: {reason}")]
20    MigrationFileFormatError { reason: String, name: String },
21}