mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-29 08:26:02 +03:00
Minor change in error handling docs
This commit is contained in:
parent
bacb0649c2
commit
399a340973
@ -65,8 +65,8 @@ If such field throws or returns unexpected value the value of the field in respo
|
|||||||
replaced with `null` and error entry will be added to response.
|
replaced with `null` and error entry will be added to response.
|
||||||
|
|
||||||
If exception is thrown in non-null field - it will be bubbled up to first nullable field which will
|
If exception is thrown in non-null field - it will be bubbled up to first nullable field which will
|
||||||
be replaced with `null` (and error entry added to response). If all fields up to the root are non-null
|
be replaced with `null` (and error entry added to response). If all fields up to the root are non-null -
|
||||||
**data** entry will be missing in response and only **errors** key will be presented.
|
**data** entry will be removed from n response and only **errors** key will be presented.
|
||||||
|
|
||||||
# Debugging tools
|
# Debugging tools
|
||||||
|
|
||||||
@ -110,11 +110,12 @@ property and data in **$data** property.
|
|||||||
|
|
||||||
Each entry of **$errors** array contains instance of `GraphQL\Error\Error` which wraps original
|
Each entry of **$errors** array contains instance of `GraphQL\Error\Error` which wraps original
|
||||||
exceptions thrown by resolvers. To access original exceptions use `$error->getPrevious()` method.
|
exceptions thrown by resolvers. To access original exceptions use `$error->getPrevious()` method.
|
||||||
But note that previous exception is only available for **Execution** errors.
|
But note that previous exception is only available for **Execution** errors and will be `null`
|
||||||
|
for **Syntax** or **Validation** errors.
|
||||||
|
|
||||||
# Schema Errors
|
# Schema Errors
|
||||||
We only covered errors which occur during query execution process. But schema definition can also
|
So far we only covered errors which occur during query execution process. But schema definition can
|
||||||
throw if there is an error in one of type definitions.
|
also throw if there is an error in one of type definitions.
|
||||||
|
|
||||||
Usually such errors mean that there is some logical error in your schema and it is the only case
|
Usually such errors mean that there is some logical error in your schema and it is the only case
|
||||||
when it makes sense to return `500` error code for GraphQL endpoint:
|
when it makes sense to return `500` error code for GraphQL endpoint:
|
||||||
|
Loading…
Reference in New Issue
Block a user