From f0d4458f8bd5e6ce105b17ef5ffdf911427bdd14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= Date: Fri, 29 Sep 2023 23:18:18 +0000 Subject: [PATCH] Improve error reporting for help topic callbacks --- crates/cmd-py/src/help.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/cmd-py/src/help.rs b/crates/cmd-py/src/help.rs index 259c23290b..44dc17459b 100644 --- a/crates/cmd-py/src/help.rs +++ b/crates/cmd-py/src/help.rs @@ -73,10 +73,14 @@ impl HelpTopicRegistry { breezy::help::HelpContents::Closure(Box::new(move |_| contents.clone())) } else { let f = contents.extract::(py)?; + let name = name.to_string(); breezy::help::HelpContents::Closure(Box::new(move |h| { - Python::with_gil(|py| { - let s = f.call1(py, (h,)).unwrap(); - s.extract::(py).unwrap() + Python::with_gil(|py| match f.call1(py, (h,)) { + Ok(s) => s.extract::(py).unwrap(), + Err(e) => { + e.print(py); + panic!("error while generating help text for {}", name); + } }) })) };