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

[Error handling] Remove category from exceptions #685

Merged
merged 3 commits into from
May 9, 2024

Conversation

cvergne
Copy link
Contributor

@cvergne cvergne commented May 9, 2024

As mentioned in #683, category support has already been removed from graphQL error responses with graphqlite because of graphql-php update to v15 ( see upgrade guide v14 -> v15 ), which means category is already missing from extensions in responses.

The purpose of this PR is to remove the category argument from Exceptions.

Caution

BC Break

The category argument has been removed from GraphQLException, which means any existing instance of a GraphQLException passing category and/or extensions will trigger an error.

BEFORE

throw new GraphQLException('foo', 0, null, 'MyCategory', ['field' => 'foo']);

AFTER

throw new GraphQLException('foo', 0, null, ['field' => 'foo']);

Note

If you want to keep category, you'll have two options :

  1. Creating your own GraphQLException class and using your own errorFormatter method
  2. Moving the category directly into extensions

Fixes #683

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.43%. Comparing base (53f9d49) to head (89fbc48).
Report is 84 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #685      +/-   ##
============================================
- Coverage     95.72%   95.43%   -0.30%     
- Complexity     1773     1805      +32     
============================================
  Files           154      171      +17     
  Lines          4586     4775     +189     
============================================
+ Hits           4390     4557     +167     
- Misses          196      218      +22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@oojacoboo
Copy link
Collaborator

@cvergne thanks for this PR!

@oojacoboo oojacoboo merged commit c4a68a8 into thecodingmachine:master May 9, 2024
9 checks passed
@cvergne cvergne deleted the category-removal branch May 10, 2024 07:42
faizanakram99 added a commit to faizanakram99/graphqlite that referenced this pull request May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Error handling] Category missing in error response
3 participants