on master help sign in
fix context in error
commit31b7596f093c313bc88867f3ba2ae9813f7c55d4 authorSkyler Hawthorne <skyler@dead10ck.com> dateSat 19 Feb 2022, 00:45 (5 years ago) parent4fc991f
1 file changed+6−10
helix-loader/src/grammar.rs+6−10
helix-loader/src/grammar.rs+6−10
@@ -123,18 +123,14 @@ where
123123 tx.send(job(grammar)).unwrap();
124124 });
125125 }
126− pool.join();
126+
127+ drop(tx);
127128
128129 // TODO: print all failures instead of the first one found.
129− if let Some(failure) = rx.try_iter().find_map(|result| result.err()) {
130− Err(anyhow!(
131− "Failed to {} some grammar(s).\n{}",
132− action,
133− failure
134− ))
135− } else {
136− Ok(())
137− }
130+ rx.iter()
131+ .find(|result| result.is_err())
132+ .map(|err| err.with_context(|| format!("Failed to {} some grammar(s)", action)))
133+ .unwrap_or(Ok(()))
138134}
139135
140136fn fetch_grammar(grammar: GrammarConfiguration) -> Result<()> {