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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
//! Module for library error
/// Error enum to store different types of error
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
/// Error type created from error raised by sqlx
#[error(transparent)]
SqlxError(#[from] sqlx::error::Error),
/// Error for failed to create migrations plan
#[error("failed to create migrations plan")]
FailedToCreateMigrationPlan,
/// Error when migration plan has applied replaces migrations as well as
/// current migration
#[error("both replace migrations and current migration are applied")]
BothMigrationTypeApplied,
/// Error for irreversible operation
#[error("operation is irreversible")]
IrreversibleOperation,
/// Error for pending migration present
#[error("pending migration present")]
PendingMigrationPresent,
/// Error when migration name is only present but not app name
#[error("app name required only migration name present")]
AppNameRequired,
/// Error when provided app name doesn't exists
#[error("provided app {app} doesn't exists")]
AppNameNotExists {
/// Name of app
app: String,
},
/// Error when provided migration name doesn't exists for app
#[error("provided migration {migration} doesn't exists for app {app}")]
MigrationNameNotExists {
/// Name of app
app: String,
/// Name of migration
migration: String,
},
/// Error when applied migrations exists
#[error("applied migrations exists. Revert all using revert subcommand")]
AppliedMigrationExists,
/// Error when unsupported database is used as any database
#[error("database not supported for any migrator")]
UnsupportedDatabase,
}