Errors
GraphQL Errors
Section titled “GraphQL Errors”We return GraphQL responses for all of our error responses. These responses will contain an error code to indicate the type of error along with a descriptive message.
Example
Section titled “Example”{ "errors": [ { "message": "Authentication failed", "locations": [], "path": [ "protectedAction" ], "extensions": { "code": "GRAPHQL_VALIDATION_FAILED", "exception" : { //If any } } } ],}The field extensions.code contains the error code for each error type and is a string.
Error Types
Section titled “Error Types”| Error Type | Error Code | Description |
|---|---|---|
| Syntax Error | GRAPHQL_PARSE_FAILED | When the input request to the API results in a malformed GraphQL object definition to the input type, graphQL throws a syntax error. |
| Validation Error | GRAPHQL_VALIDATION_FAILED | When the input request to the API fails GraphQL type checking on request object, graphQL throws a validation error. |
| Authentication Error | UNAUTHENTICATED | When the basic authentication token passed through the header is invalid and hence the user cannot be authenticated, we throw an authentication error. |
| UserInput Error | BAD_USER_INPUT | When the input request to the API contains values for the fields that is invalid, we throw a user input error. |
| Rate Limiting Error | TOO_MANY_REQUESTS | When the number of requests to the API has exceeded the limit, we throw a too many requests error. |
| AlreadyExists Error | ALREADY_EXISTS | When trying to create a record that breaks some uniqueness constraint. |
| Unhandled Error | INTERNAL_SERVER_ERROR | This will happen if our server is a degraded state. |