-
Notifications
You must be signed in to change notification settings - Fork 0
chore: add external error interceptor #61
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #61 +/- ##
============================================
- Coverage 77.66% 72.32% -5.34%
Complexity 172 172
============================================
Files 24 25 +1
Lines 488 524 +36
Branches 26 26
============================================
Hits 379 379
- Misses 85 121 +36
Partials 24 24
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
* This interceptor can be used at the edge to scrub any sensitive information such as an exception | ||
* cause or metadata off the context before propagating it | ||
*/ | ||
public class ExternalExceptionInterceptor implements ServerInterceptor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we define this as an abstract class so that one can define custom message and custom trailer building logic 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not an abstract class and we typically would not expect these t o be configured differently in different services but I'll open up a couple of protected hooks for extension if needed.
Description
This interceptor is meant to be used in edge services to prevent leaking any sensitive information. It only propagates status code, an external message and request ID, if set. All other metadata such as cause and metadata are stripped.