Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
scx1332 committed Jul 16, 2024
1 parent 5e314f1 commit 056d1fc
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions crates/erc20_payment_lib_common/src/db/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,25 @@ pub async fn create_sqlite_connection(
.map_err(err_from!())?;

if run_migrations {
if let Err(e) = MIGRATOR.run(&pool).await {
MIGRATOR.run(&pool).await.map_err(|e| {
let file_part = if let Some(path) = path {
format!("file {}", path.display())
} else {
url
};
return match e {
match e {
MigrateError::VersionMissing(_) => {
Err(err_custom_create!(
"Version missing in {file_part}, probably previously run with newer version of application: {e}",
))
err_custom_create!(
"Error during migration in {file_part}, probably previously run with newer version of application: {e}",
)
}
_ => {
Err(err_custom_create!(
err_custom_create!(
"Migration error in {file_part}: {e}",
))
)
}
};
}
}
})?
}

Ok(pool)
Expand Down

0 comments on commit 056d1fc

Please sign in to comment.