My Products
Help
Florian Haase
PARTNER

Errorhandling

by Florian Haase

Hi there,

 

When I'm sending a query with syntax error I still get a 200 response-code. But I actually don't know what the standard graphql specification says about that - maybe this is correct due to spec?

 

Florian

2 REPLIES 2

by Marius Bancila
omelhus
PARTNER

by omelhus (Updated ‎30-06-2022 11:14 by omelhus PARTNER )

You will always get a 200 response with GraphQL, unless your token is expired. Then it's 401. All errors are reported in the errors-property on the response object, and some libraries (like StrawberryShake) provide helpers like ".EnsureSuccessful()" to verify that the response is without errors.

 

The drawback with this is that a query or mutation can be partially successful and return a warning, but you won't consider it an error.