-
-
Notifications
You must be signed in to change notification settings - Fork 9
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 ErrorHandler #11
Comments
Added two example PRs for this. Ran into the missing context when migration to chi from gin which has a context in the validation middleware: type ErrorHandler func(c *gin.Context, message string, statusCode int) |
There is definitely a need for more info in the error handler. Context is one such need, but the current matched Route, the Request, and the Request's Headers — like I created a PR (#15) that (I think) addresses @pebo's use-case in this issue but also addresses others, and in a manner that will allow adding other info if such info is found to be needed by others in the future. Hopefully PR #15 can supersede PRs #13 and #14 since they change error handling but don't address the use-cases that #15 address. |
Would love to see this merged! Seems it's waiting on a review from the maintainer. |
+1 for this feature. I agree with @mikeschinkel that it should be not just the So I propose the new signature to be:
What do you guys think? |
@tmzane — Definitely agree that having the original Have you looked at PR #15? I could see it added to |
In order to correlate custom ErrorHandler logging with requests if would be very helpful if the ErrorHandler signature was expanded to include
context.Context
e.g.This however is a breaking change so another option could be to expand
Options
with aErrorHandlerWithContext
field.The text was updated successfully, but these errors were encountered: