Errors are a part of life. The guide below will help you understand the various codes Yuzu will return and recovery patterns.
Error responses in GraphQL will not present like errors from traditional APIs. All responses from GraphQL APIs, execept network errors (e.g., 503 Bad Gateway
), will return a 200 status code. In an error message, however, the data
parameter will be null
, replaced by errors
, e.g.:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
Yuzu uses the extensions
object to specify a code which can be handled, e.g., BAD_USER_INPUT
in the example above.
Code | Recoverable? | Description | Recovery |
---|---|---|---|
UNAUTHENTICATED |
No | Returned when no API keys is present in the request | N/A |
FORBIDDEN |
No | Returned when the host is not properly allow-listed | N/A |
RATE_LIMIT_EXCEEDED |
Yes | Returned when client has exceeded the request limit on community plans | Wait 1 second until the request count is reset |
BAD_USER_INPUT |
Yes | Returned when input is invalid | If input is from user, display the error message and collect new input |