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

Bug: GraphQL "BaseMutation" does not report errors properly #394

Open
david-code opened this issue Apr 3, 2023 · 1 comment
Open

Bug: GraphQL "BaseMutation" does not report errors properly #394

david-code opened this issue Apr 3, 2023 · 1 comment

Comments

@david-code
Copy link
Contributor

david-code commented Apr 3, 2023

Description

A mutation inheriting from the BaseWriteMutation should report errors in the errors field of the mutation type. This currently does not happen; the mutation type is instead returned as an empty object.

Reproduction

I've reproduced this issue in the linked branch fix/graphql-mutations-errors. I basically created a mutation that will always throw an exception, as well as a test that asserts that the error field is present in the mutation payload. You can see the test error in the workflow. Here's the assertion error:

AssertionError: assert 'errors' in {'clientMutationId': None}

You can see that the test tries to make sure the errors field is in the payload and fails because it doesn't find anything present.

Solution

I think a temporary solution I will use for now is to make the GraphQL mutation return type fields required. In this case, when there is an error the errors field will at least contain something, so it's possible to check when an exception has been thrown.

I'm not sure what the best long-term solution would be.

@david-code david-code changed the title Bug: Bug: GraphQL "BaseMutation" does not report errors properly Apr 3, 2023
@david-code
Copy link
Contributor Author

@josebui could you take a look and let me know what you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

2 participants