Show error message after panic (#1752)
Previously we were swallowing errors and silently exiting, which isn't great for helping users help us.
This commit is contained in:
@@ -176,9 +176,13 @@ fn run_ratatui_app(
|
||||
color_eyre::install()?;
|
||||
|
||||
// Forward panic reports through tracing so they appear in the UI status
|
||||
// line instead of interleaving raw panic output with the interface.
|
||||
std::panic::set_hook(Box::new(|info| {
|
||||
// line, but do not swallow the default/color-eyre panic handler.
|
||||
// Chain to the previous hook so users still get a rich panic report
|
||||
// (including backtraces) after we restore the terminal.
|
||||
let prev_hook = std::panic::take_hook();
|
||||
std::panic::set_hook(Box::new(move |info| {
|
||||
tracing::error!("panic: {info}");
|
||||
prev_hook(info);
|
||||
}));
|
||||
let mut terminal = tui::init(&config)?;
|
||||
terminal.clear()?;
|
||||
|
||||
Reference in New Issue
Block a user