-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
cannot use multiple different error handlers in one gateway binary #1143
Comments
I guess a less-breaking alternative patch would be to modify DefaultHTTPError to look and see if there is a configured protoErrorHandler (and stop overwriting HTTPError when configuring protoErrorHandler). Then the current generated code continues to operate. |
Actually, that would lead to trouble if someone tried to explicitly configure DefaultHTTPError as the proto error handler. It also means clients can't use We could initialize |
The latter option sounds good to me, please put together a PR if you can find the time. |
Support specifying different custom error handlers on different muxes, or specifying custom error handlers on some muxes and using the default handlers on others. Make the runtime.HTTPError use the mux-configured error handler if present, and allow overriding the global default behavior by setting GlobalHTTPErrorHandler. Add commentary explaining the use of the different options for controlling error handling.
…stem#1144) * Fix grpc-ecosystem#1143: Support multiple error handlers. Support specifying different custom error handlers on different muxes, or specifying custom error handlers on some muxes and using the default handlers on others. Make the runtime.HTTPError use the mux-configured error handler if present, and allow overriding the global default behavior by setting GlobalHTTPErrorHandler. Add commentary explaining the use of the different options for controlling error handling. * Stop overwriting HTTPError. * Fix WithProtoErrorHandler comment. * Document error customization options.
…stem#1144) * Fix grpc-ecosystem#1143: Support multiple error handlers. Support specifying different custom error handlers on different muxes, or specifying custom error handlers on some muxes and using the default handlers on others. Make the runtime.HTTPError use the mux-configured error handler if present, and allow overriding the global default behavior by setting GlobalHTTPErrorHandler. Add commentary explaining the use of the different options for controlling error handling. * Stop overwriting HTTPError. * Fix WithProtoErrorHandler comment. * Document error customization options.
Fill in the following sections with explanations of what's gone wrong.
Steps you follow to reproduce the error:
runtime.WithProtoErrorHandler
. Register it to handle prefix "/v2".Observe that the v2 error handler runs for:
Errors from within runtime.ServeMux code (like unknown URIs) under v1 result in
unexpected use of OtherErrorHandler
errors.What did you expect to happen instead:
What's your theory on why it isn't working:
WithProtoErrorHandler
option overwrites a global handler HTTPError and configures the global OtherErrorHandler to return "unexpected use" errors:grpc-gateway/runtime/mux.go
Line 169 in 9aff355
grpc-gateway/protoc-gen-grpc-gateway/gengateway/template.go
Line 571 in 9aff355
An initial patch to fix this issue can be seen here: master...paxosglobal:per-mux-error-handler
However, since this does change the generated code to rely on the updated runtime code, I'd appreciate guidance on the process for handling/merging this kind of breaking change.
The text was updated successfully, but these errors were encountered: