You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.
I wanted to switch the style of a specific report, this to circumvent #122 not working and it not being formatted optimally with the env section being repeated.
I have the following code
pubfnadd_reports(origin: eyre::Report,iter:implIntoIterator<Item = eyre::Report>,) -> eyre::Report{use color_eyre::{Sectionas _,SectionExtas _};
iter.into_iter().fold(origin, |report,mut e| {// Create a new Handlerlet custom_handler = color_eyre::config::HookBuilder::new()// disable env section.display_env_section(false).into_hooks()// <---- Panic here!!!.1.into_eyre_hook();letmut custom_handler = custom_handler(e.source().unwrap_or(e.root_cause()));let custom_handler = custom_handler
.downcast_mut::<color_eyre::Handler>().unwrap();// get the current Handlerlet handler = e.handler_mut();let handler = handler.downcast_mut::<color_eyre::Handler>().unwrap();
std::mem::swap(handler, custom_handler);
report.section(format!("{e:?}").header("Error:"))})}
but I get a panic:
The application panicked (crashed).
Message: could not set the provided `Theme` via `color_spantrace::set_theme` globally as another was already set: InstallThemeError
Location: .cargo/registry/src/index.crates.io-6f17d22bba15001f/color-eyre-0.6.2/src/config.rs:756
Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
The issue is that HookBuilder::into_hooks calls color_spantrace::set_theme
This issue persists on the current master branch as well.
Now, I'm not sure if this is truly the way to go so I have two propositions that would make me happy.
Provide a way to create a EyreHook without set_theme (this would also need a way to get the location I discovered, to propagate into the new handler)
Enable a way to change the settings on a specific report, e.g report.handler_mut().downcast_mut::<color_eyre::Handler>().unwrap().display_env_section = false
I think that nr. 2 is the best option, since it makes it easy to customize a report "in-flight"
The text was updated successfully, but these errors were encountered:
I wanted to switch the style of a specific report, this to circumvent #122 not working and it not being formatted optimally with the env section being repeated.
I have the following code
but I get a panic:
The issue is that
HookBuilder::into_hooks
callscolor_spantrace::set_theme
https://github.com/eyre-rs/color-eyre/blame/6a9b70b44d11e0540b9dbc325149bab2a5d505b6/src/config.rs#L756
This issue persists on the current
master
branch as well.Now, I'm not sure if this is truly the way to go so I have two propositions that would make me happy.
EyreHook
withoutset_theme
(this would also need a way to get the location I discovered, to propagate into the new handler)report.handler_mut().downcast_mut::<color_eyre::Handler>().unwrap().display_env_section = false
I think that nr. 2 is the best option, since it makes it easy to customize a report "in-flight"
The text was updated successfully, but these errors were encountered: