Skip to content

Commit 9fee169

Browse files
committed
Any execution may include onError
1 parent 9209832 commit 9fee169

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

spec/Section 6 -- Execution.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,25 @@ A GraphQL service generates a response from a request via execution.
1515
being executed. Conceptually, an initial value represents the "universe" of
1616
data available via a GraphQL Service. It is common for a GraphQL Service to
1717
always use the same initial value for every request.
18-
- {errors} (optional): The _error behavior_ that is desired, see
18+
- {onError} (optional): The _error behavior_ that is desired, see
1919
[Handling Execution Errors](#sec-Handling-Execution-Errors).
2020

2121
Given this information, the result of {ExecuteRequest(schema, document,
2222
operationName, variableValues, initialValue)} produces the response, to be
23-
formatted according to the Response section below. The value of {errors} is
24-
referenced by the [Handling Execution Errors](#sec-Handling-Execution-Errors)
25-
section only, so we do not complicate the algorithms by passing it through every
26-
call.
23+
formatted according to the Response section below.
24+
25+
Servers should use the value of {onError}, if present, as the _error behavior_
26+
of the request described in
27+
[Handling Execution Errors](#sec-Handling-Execution-Errors). However, it should
28+
be noted that previous versions of this specification did not make this option
29+
available and thus a client must not rely on the server to honor the {onError}
30+
value it has specified. If a _response_ includes {"errors"}, the client must
31+
check the {"onError"} of the _response_ determine how errors are treated. If no
32+
such property is present, the client must treat the request as if it had
33+
specified {onError} as {"PROPAGATE"}.
34+
35+
If {onError} is present and it's value is not one of {"PROPAGATE"},
36+
{"NO_PROPAGATE"}, or {"ABORT"} then a request error must be raised.
2737

2838
Note: GraphQL requests do not require any specific serialization format or
2939
transport mechanism. Message serialization and transport mechanisms should be
@@ -833,7 +843,8 @@ If a `List` type wraps a `Non-Null` type, and one of the elements of that list
833843
resolves to {null}, then an execution error is raised by the list item.
834844

835845
:: The _error behavior_ is the way in which the request wishes for errors to be
836-
handled. Valid values are {"PROPAGATE"}, {"NO_PROPAGATE"} and {"ABORT"}; their
846+
handled. It can be specified by the client using the {onError} property of the
847+
_request_. Valid values are {"PROPAGATE"}, {"NO_PROPAGATE"} and {"ABORT"}; their
837848
respective behaviors are detailed below.
838849

839850
Implementations are free to choose the default value to use if _error behavior_

spec/Section 7 -- Response.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ validation error, this entry must not be present.
2828

2929
If the request included execution, raised any errors, and the _error behavior_
3030
was not {"PROPAGATE"} then the response map must contain an entry with key
31-
`errors`. Otherwise, inclusion of the `errors` key is permitted but not
32-
recommended. The value of this key, if present, must be that of the _error
33-
behavior_.
31+
`onError`. Otherwise if the request included execution, the server may include
32+
the `onError` key. Otherwise, inclusion of the `onError` key is not recommended
33+
(but is permitted). The value of this key, if present, must be that of the
34+
_error behavior_.
3435

3536
The response map may also contain an entry with key `extensions`. This entry, if
3637
set, must have a map as its value. This entry is reserved for implementers to

0 commit comments

Comments
 (0)