Better migration error message
This commit is contained in:
parent
0e63f64513
commit
1020f27413
2 changed files with 4 additions and 4 deletions
|
@ -17,8 +17,8 @@ pub enum Error {
|
|||
ConnectionPool,
|
||||
#[error("Filesystem error for `{0}`: `{1}`")]
|
||||
Io(PathBuf, std::io::Error),
|
||||
#[error("Could not apply database migrations")]
|
||||
Migration,
|
||||
#[error("Could not apply database migrations: {0}")]
|
||||
Migration(sqlx::migrate::MigrateError),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -53,7 +53,7 @@ impl DB {
|
|||
.run(&self.pool)
|
||||
.await
|
||||
.and(Ok(()))
|
||||
.or(Err(Error::Migration))
|
||||
.map_err(Error::Migration)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ impl From<db::Error> for APIError {
|
|||
db::Error::ConnectionPoolBuild => APIError::Internal,
|
||||
db::Error::ConnectionPool => APIError::Internal,
|
||||
db::Error::Io(p, e) => APIError::Io(p, e),
|
||||
db::Error::Migration => APIError::Internal,
|
||||
db::Error::Migration(_) => APIError::Internal,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue