-
Notifications
You must be signed in to change notification settings - Fork 172
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
feat(api): add interceptor to bubble up underlying error code #1266
Conversation
✅ Deploy Preview for docs-kargo-akuity-io ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1266 +/- ##
==========================================
- Coverage 45.56% 45.31% -0.25%
==========================================
Files 135 137 +2
Lines 11657 11791 +134
==========================================
+ Hits 5311 5343 +32
- Misses 6155 6256 +101
- Partials 191 192 +1 ☔ View full report in Codecov by Sentry. |
@krancour Changed interceptor to wrap error if the given error is |
@devholic it also looks like there might be several remaining cases where a handler does a That explicit handling can be removed now, right? |
@krancour I'm still not sure whether it's okay to remove explicit error handling in handlers.
|
@devholic handlers should be tested independently of any interceptors. |
Resolves #1215 Signed-off-by: Sunghoon Kang <hoon@akuity.io>
Signed-off-by: Sunghoon Kang <hoon@akuity.io>
Signed-off-by: Sunghoon Kang <hoon@akuity.io>
Signed-off-by: Sunghoon Kang <hoon@akuity.io>
Signed-off-by: Sunghoon Kang <hoon@akuity.io>
Signed-off-by: Sunghoon Kang <hoon@akuity.io>
Signed-off-by: Sunghoon Kang <hoon@akuity.io>
Code looks good @devholic. I'm going to test drive e2e Monday morning. |
I tried this with a variety of error cases just now. Overall, it's working great, but I did notice that 422 (unprocessable content/entity) is something k8s may sometimes return when, for instance, a webhook or other admission control has found something invalid in a resource, but that's a status code the interceptor isn't mapping. @devholic I think maybe we should handle that case the same as "bad request." I couldn't find a connect error code that was a better mapping than that. Easy way to see this in action is through |
Signed-off-by: Sunghoon Kang <hoon@akuity.io>
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.
This now shows the anticipated error type for every error I've been able to force. 🔥
Thank you @devholic!
Resolves #1215