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 context to error handler's HandleError and HandlePanic #13

Merged
merged 1 commit into from
Nov 12, 2023

Commits on Nov 12, 2023

  1. Add context to error handler's HandleError and HandlePanic

    As I was writing the documentation for `ErrorHandler` I realized that
    it'd probably be desirable for its `HandleError` and `HandlePanic`
    functions to take a context. The user might, for example, have a logger
    embedded in context which they'd extract and use the log the error or
    panic. This could also be done with a member field on implementing
    struct of course, but it feels like making context available doesn't
    really have a downside and its presence would likely be expected by some
    users.
    
    Another benefit is that in case someone is doing some heavy lifting in
    one of these (they probably shouldn't be, but just in case), their
    handlers could respond to the context cancellation caused by a client
    `StopAndCancel` shutdown. Currently, the handlers are immune to
    cancellation and could conceivably cause a shutdown to be stuck.
    brandur committed Nov 12, 2023
    Configuration menu
    Copy the full SHA
    e2a00fc View commit details
    Browse the repository at this point in the history