-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
4 changed files
with
32 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters