Skip to content

Commit 1797e55

Browse files
fix: propagate glob errors in mint_from_files and remove stale TODO (#372)
mint_from_files was logging glob errors but returning Ok(()), silently swallowing failures. Now returns an error so callers know files failed to read. Also removes a stale TODO comment where error handling was already in place via the ? operator. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1c402be commit 1797e55

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/mint.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,15 @@ pub fn mint_from_files(
171171
}
172172
});
173173

174-
// TODO: handle errors in a better way.
175174
if !errors.is_empty() {
176175
error!("Failed to read some of the files with the following errors:");
177-
for error in errors {
176+
for error in &errors {
178177
error!("{}", error);
179178
}
179+
return Err(anyhow!(
180+
"Failed to read {} file(s) in the directory",
181+
errors.len()
182+
));
180183
}
181184

182185
Ok(())
@@ -494,7 +497,6 @@ pub fn mint_one<P: AsRef<Path>>(
494497
let message = format!("Tx sig: {:?}\nMint account: {:?}", &tx_id, &mint_account,);
495498
println!("{message}");
496499
if sign {
497-
//TODO: Error handling
498500
sign_one(client, keypair_path, mint_account.to_string())?;
499501
}
500502

0 commit comments

Comments
 (0)