Skip to content

Commit 551d207

Browse files
committed
cli: use more specific error messages
1 parent 600fc73 commit 551d207

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

refinery_cli/src/migrate.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,20 @@ fn run_migrations(
3636
let mut migrations = Vec::new();
3737
for path in migration_files_path {
3838
let sql = std::fs::read_to_string(path.as_path())
39-
.with_context(|| format!("could not read migration file name {}", path.display()))?;
39+
.with_context(|| format!("Could not read contents of file {}", path.display()))?;
4040

4141
//safe to call unwrap as find_migration_filenames returns canonical paths
4242
let filename = path
4343
.file_name()
4444
.and_then(|file| file.to_os_string().into_string().ok())
4545
.unwrap();
4646

47-
let migration = Migration::unapplied(&filename, &sql)
48-
.with_context(|| format!("could not read migration file name {}", path.display()))?;
47+
let migration = Migration::unapplied(&filename, &sql).with_context(|| {
48+
format!(
49+
"Could not create new migration from contents of file {}",
50+
path.display()
51+
)
52+
})?;
4953
migrations.push(migration);
5054
}
5155
let mut config = config(config_location, env_var_opt)?;

0 commit comments

Comments
 (0)