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
//! 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)]
Sqlx(#[from] sqlx::Error),
/// Error type created from error raised by box error
#[error(transparent)]
Box(#[from] Box<dyn std::error::Error + Send + Sync>),
/// Error type created from error raised by std input output
#[cfg(feature = "cli")]
#[error(transparent)]
StdIo(#[from] std::io::Error),
/// Error generated during planning state
#[error("plan error: {message}")]
PlanError {
/// Message for error
message: String,
},
/// Error for irreversible operation
#[error("operation is irreversible")]
IrreversibleOperation,
/// Error for pending migration present
#[cfg(feature = "cli")]
#[error("pending migration present")]
PendingMigrationPresent,
/// Error when applied migrations exists
#[cfg(feature = "cli")]
#[error("applied migrations exists. Revert all using revert subcommand")]
AppliedMigrationExists,
/// Error when unsupported database is used as any database
#[error("database not supported")]
UnsupportedDatabase,
/// Error when table prefix is invalid
#[error("table prefix name can only contain [a-z0-9_]")]
InvalidTablePrefix,
/// Error when passed schema name is invalid
#[error("schema name can only contain [a-z0-9_] and begin with [a-z_]")]
InvalidSchema,
/// Error raised when two migration with same name are added and there value
/// is not consistent
#[error("migration for app: {app} with name: {name} consists of inconsistent values")]
InconsistentMigration {
/// Migration application name
app: String,
/// Migration name
name: String,
},
/// Error raised when virtual migration is invalid virtual migration is
/// invalid if it have any fields present expect app name and migration name
#[error("invalid virtual migration")]
InvalidVirtualMigration,
}