-
-
Notifications
You must be signed in to change notification settings - Fork 543
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: propagate entity resolver original error details to response #3144
feat: propagate entity resolver original error details to response #3144
Conversation
Thanks for adding the Here's a preview of the changelog: Update federation entity resolver exception handling to set the result to the original error instead of a Here's the tweet text:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3144 +/- ##
==========================================
- Coverage 96.58% 96.57% -0.02%
==========================================
Files 524 525 +1
Lines 33632 33958 +326
Branches 5577 5603 +26
==========================================
+ Hits 32485 32796 +311
- Misses 912 925 +13
- Partials 235 237 +2 |
CodSpeed Performance ReportMerging #3144 will not alter performanceComparing Summary
|
ff4ccb2
to
73e887a
Compare
for more information, see https://pre-commit.ci
…xception if already a TypeError
for more information, see https://pre-commit.ci
6dd4271
to
e6f8dc4
Compare
c587414
to
53d77a0
Compare
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 looks good to me now. This PR makes it easier for devs to spot code errors and adds additional well-writiten tests to the federation integration, which is awesome. Thanks again @bradleyoesch
Error details from errors thrown in entity resolution are swallowed by a generic failure message that also leaks internal code paths, so instead we should propagate the original error.
Description
When an entity resolver throws an exception, add the thrown exception to the result. Turns out graphql-core handles mapping it to a
GraphQLError
with location/path info for us (link) so we don't want to raise our ownGraphQLError
.If the exception is a
TypeError
, we assume the resolver was incorrectly implemented, which throws aTypeError
under the hood (we check the type name explicitly so that clients can raise their own customTypeErrors
without losing data). The generic message now just outputs the type name rather than the full path, which includes file directory structure that shouldn't (imo) be exposed to the response.To be honest, I don't love this type error approach, so I'm up for alternatives!
Types of Changes
Issues Fixed or Closed by This PR
Checklist