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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
//! 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),
#[cfg(feature = "cli")]
/// Error type created from error raised by std input output
#[error(transparent)]
StdIoError(#[from] std::io::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,
#[cfg(feature = "cli")]
/// 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,
},
#[cfg(feature = "cli")]
/// Error when applied migrations exists
#[error("applied migrations exists. Revert all using revert subcommand")]
AppliedMigrationExists,
#[cfg(feature = "cli")]
/// Error when count of migrations is big than total number of migration
#[error("count of migrations is big only {actual_len} present passed {count}")]
CountGreater {
/// Actual length of migration
actual_len: usize,
/// Count passed in option
count: usize,
},
/// Error when unsupported database is used as any database
#[error("database not supported for any migrator")]
UnsupportedDatabase,
/// Error when passed prefix is not alpha numeric
#[error("prefix can only be ascii alphanumeric and underscore character")]
NonAsciiAlphaNumeric,
}