Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Mechanism to add sections in hook callback #137

Open
ColonelThirtyTwo opened this issue Oct 10, 2023 · 0 comments
Open

Mechanism to add sections in hook callback #137

ColonelThirtyTwo opened this issue Oct 10, 2023 · 0 comments

Comments

@ColonelThirtyTwo
Copy link

It'd be convenient if a callback could be registered with color_eyre::config::HookBuilder that gets called with the error passed to the EyreHandler and can add sections to the returned Report.

My use case is annotating 3rd party errors with additional info by downcasting them from the std::error::Error reference. For example, I could create a section with the url, status, and body from a reqwest::Error without having to annotate every single place where the conversion happens.

I could potentially do this by wrapping the color_eyre::config::EyreHook returned by the HookBuilder but it's limited to writing some text before and/or after the call to Handler.debug/display, which isn't pretty.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant