on main help sign in
Output the failing filename when showing a parse error (#13)

Co-authored-by: April Schleck <april@exclusivelyducks.com>

commitce7a0b38ee907647eba4efc8522bc9cb666300b7 authorApril Schleck <github@exclusivelyducks.com> dateTue 26 Jul 2022, 06:59 (4 years ago) parentb626ee1
1 file changed+3−1
src/main.rs+3−1
src/main.rs+3−1
@@ -4,6 +4,7 @@ use std::{
44 path::Path,
55};
66
7+use anyhow::{Context};
78use clap::{Args, Parser};
89use reshape::{
910 migrations::{Action, Migration},
@@ -211,7 +212,8 @@ fn find_migrations(opts: &FindMigrationsOptions) -> anyhow::Result<Vec<Migration
211212 .map(|result| {
212213 result.and_then(|(path, data)| {
213214 let extension = path.extension().and_then(|ext| ext.to_str()).unwrap();
214− let file_migration = decode_migration_file(&data, extension)?;
215+ let file_migration = decode_migration_file(&data, extension)
216+ .with_context(|| format!("failed to parse migration file {}", path.display()))?;
215217
216218 let file_name = path.file_stem().and_then(|name| name.to_str()).unwrap();
217219 Ok(Migration {