Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pub to make_handler #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Palladinium
Copy link

@Palladinium Palladinium commented Mar 19, 2024

I would like to set stable_eyre's hook as my eyre hook, but also do something else application-specific alongside it.

Currently, stable_eyre::install() just calls HookBuilder::install(), which in turn calls eyre::set_hook() like this:

crate::eyre::set_hook(Box::new(move |e| Box::new(self.make_handler(e))))?;

I'd like to be able to write something like this:

let hook_builder = stable_eyre::HookBuilder::default();
stable_eyre::eyre::set_hook(Box::new(move |e| {
    do_something_else(e);
    Box::new(hook_builder.make_handler(e))
}))?;

However, HookBuilder::make_handler() is private, and so I can't construct or wrap stable-eyre's Handler, and install() doesn't give any options to run extra code at hook-time.

This PR fixes that.

@ten3roberts
Copy link

Thank you.

Do you mind adding a short doc-comment to the function now that it is a public api?

@pksunkara
Copy link

@ten3roberts Can you please resolve this PR before I pull this repo into monorepo?

@ten3roberts
Copy link

Sure thing, will get to it when I'm back tonight

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

Successfully merging this pull request may close these issues.

3 participants