on master help sign in
fix context in error
31b7596Skyler Hawthorne
helix-loader/src/grammar.rs+6−10
@@ -123,18 +123,14 @@ where
123 tx.send(job(grammar)).unwrap();
123 tx.send(job(grammar)).unwrap();
124 });
124 });
125 }
125 }
126− pool.join();
126+
127+ drop(tx);
127
128
128 // TODO: print all failures instead of the first one found.
129 // TODO: print all failures instead of the first one found.
129− if let Some(failure) = rx.try_iter().find_map(|result| result.err()) {
130+ rx.iter()
130− Err(anyhow!(
131+ .find(|result| result.is_err())
131− "Failed to {} some grammar(s).\n{}",
132+ .map(|err| err.with_context(|| format!("Failed to {} some grammar(s)", action)))
132− action,
133+ .unwrap_or(Ok(()))
133− failure
134− ))
135− } else {
136− Ok(())
137− }
138}
134}
139
135
140fn fetch_grammar(grammar: GrammarConfiguration) -> Result<()> {
136fn fetch_grammar(grammar: GrammarConfiguration) -> Result<()> {