fix context in error

pull/1784/head
Skyler Hawthorne 3 years ago committed by Blaž Hrastnik
parent 4fc991fdec
commit 31b7596f09

@ -123,18 +123,14 @@ where
tx.send(job(grammar)).unwrap(); tx.send(job(grammar)).unwrap();
}); });
} }
pool.join();
drop(tx);
// TODO: print all failures instead of the first one found. // TODO: print all failures instead of the first one found.
if let Some(failure) = rx.try_iter().find_map(|result| result.err()) { rx.iter()
Err(anyhow!( .find(|result| result.is_err())
"Failed to {} some grammar(s).\n{}", .map(|err| err.with_context(|| format!("Failed to {} some grammar(s)", action)))
action, .unwrap_or(Ok(()))
failure
))
} else {
Ok(())
}
} }
fn fetch_grammar(grammar: GrammarConfiguration) -> Result<()> { fn fetch_grammar(grammar: GrammarConfiguration) -> Result<()> {

Loading…
Cancel
Save