Errors
The Grafbase gateway only the returns the following HTTP status codes:
| HTTP Status code | Description |
|---|---|
| 200 | GraphQL response is returned |
| 400 | Invalid request, ex: invalid JSON |
| 500 | Internal server error |
All GraphQL errors that may be returned will have an error code in extensions:
| Error Code | Description |
|---|---|
| BAD_REQUEST | Bad request |
| INTERNAL_SERVER_ERROR | Internal server error |
| TRUSTED_DOCUMENT_ERROR | Trusted document could not be loaded or doesn't exist |
| PERSISTED_QUERY_ERROR | Automatic persisted query failed |
| PERSISTED_QUERY_NOT_FOUND | Automatic persisted query was not found and must be provided |
| SUBGRAPH_ERROR | GraphQL error coming from the subgraph |
| SUBGRAPH_INVALID_RESPONSE_ERROR | Subgraph returned an invalid response |
| SUBGRAPH_REQUEST_ERROR | Request to the subgraph failed |
| UNAUTHENTICATED | User is not authenticated |
| UNAUTHORIZED | User is not authorized |
| OPERATION_PARSING_ERROR | Operation parsing failed |
| OPERATION_VALIDATION_ERROR | Operation validation failed |
| OPERATION_PLANNING_ERROR | Operation planning failed |
| HOOK_ERROR | Hook failed or returned an error |
| RATE_LIMITED | Request was rate limited |
| GATEWAY_TIMEOUT | Request execeed the global timeout |
Hooks can override the error code by specifying one in the code extension field of the GraphQL error they emit.