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

Convert errors thrown from interceptors #2209

Merged
merged 2 commits into from
Mar 18, 2025

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Mar 18, 2025

Motivation:

gRPC checks whether errors thrown from interceptors are RPCError and otherwise treats them as unknown (to avoid leaking internal information). There is a third possibility: the error is explicitly marked as being convertible to an RPCError. This check is currently missing when thrown from client/server interceptors.

Modifications:

  • Catch RPCErrorConvertible in the client/server executors when thrown from interceptors
  • Add tests

Result:

Error information isn't dropped

Motivation:

gRPC checks whether errors thrown from interceptors are `RPCError` and
otherwise treats them as `unknown` (to avoid leaking internal
information). There is a third possibility: the error is explicitly
marked as being convertible to an `RPCError`. This check is currently
missing when thrown from client/server interceptors.

Modifications:

- Catch `RPCErrorConvertible` in the client/server executors when thrown
  from interceptors
- Add tests

Result:

Error information isn't dropped
@glbrntt glbrntt requested a review from gjcairo March 18, 2025 09:34
@glbrntt glbrntt added the 🔨 semver/patch No public API change. label Mar 18, 2025
@glbrntt glbrntt merged commit c4d6281 into grpc:main Mar 18, 2025
32 checks passed
@glbrntt glbrntt deleted the v2/error-convertible branch March 18, 2025 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants