eyre-rs / color-eyre

Custom hooks for colorful human oriented error reports via panics and the eyre crate
Other
958 stars 57 forks source link

Disable setting panic hook #144

Open ten3roberts opened 9 months ago

ten3roberts commented 9 months ago

Add an option for the builder to disable the setting the panic hook, and only setting the eyre hook.

This is useful for targeting the web where you may already use console_error_panic_hook

ten3roberts commented 9 months ago

Workaround:

let (_, eyre_hook) = color_eyre::config::HookBuilder::default().into_hooks();
eyre_hook.install().unwrap();
MolotovCherry commented 6 months ago

I was encountering an issue with their tracing example, cause I had other error handlers initiated. This helped me, since I wanted to only enable the panic hook but not the error hook. Same principle above, except .0 instead of .1. Thanks!

Edit: Figured out the issue, for some reason using eyre (eyre!() and Result) before setting the hooks somehow caused a hook to get set, even though I never set it. That caused the error hook to error out as it was already "set"