Skip to content

Commit b66f783

Browse files
committed
Also use consistent error verbs
Saw "throw" / "raise" / "occur" / "encounter" - most dominant verb is "raise" so standardizing that.
1 parent 4ef71bb commit b66f783

File tree

4 files changed

+31
-32
lines changed

4 files changed

+31
-32
lines changed

spec/Section 3 -- Type System.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,10 +1514,10 @@ type of an Object or Interface field.
15141514
**Input Coercion**
15151515

15161516
The value for an input object should be an input object literal or an unordered
1517-
map supplied by a variable, otherwise a request error must be thrown. In either
1517+
map supplied by a variable, otherwise a request error must be raised. In either
15181518
case, the input object literal or unordered map must not contain any entries
15191519
with names not defined by a field of this input object type, otherwise an error
1520-
must be thrown.
1520+
must be raised.
15211521

15221522
The result of coercion is an unordered map with an entry for each field both
15231523
defined by the input object type and for which a value exists. The resulting map
@@ -1526,7 +1526,7 @@ is constructed with the following rules:
15261526
* If no value is provided for a defined input object field and that field
15271527
definition provides a default value, the default value should be used. If no
15281528
default value is provided and the input object field's type is non-null, an
1529-
error should be thrown. Otherwise, if the field is not required, then no entry
1529+
error should be raised. Otherwise, if the field is not required, then no entry
15301530
is added to the coerced unordered map.
15311531

15321532
* If the value {null} was provided for an input object field, and the field's
@@ -1540,7 +1540,7 @@ is constructed with the following rules:
15401540

15411541
* If a variable is provided for an input object field, the runtime value of that
15421542
variable must be used. If the runtime value is {null} and the field type
1543-
is non-null, a field error must be thrown. If no runtime value is provided,
1543+
is non-null, a field error must be raised. If no runtime value is provided,
15441544
the variable definition's default value should be used. If the variable
15451545
definition does not provide a default value, the input object field
15461546
definition's default value should be used.

spec/Section 5 -- Validation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2013,4 +2013,4 @@ query booleanArgQueryWithDefault($booleanArg: Boolean = true) {
20132013
```
20142014

20152015
Note: The value {null} could still be provided to such a variable at runtime.
2016-
A non-null argument must produce a field error if provided a {null} value.
2016+
A non-null argument must raise a field error if provided a {null} value.

spec/Section 6 -- Execution.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ GetOperation(document, operationName):
4141
* If {operationName} is {null}:
4242
* If {document} contains exactly one operation.
4343
* Return the Operation contained in the {document}.
44-
* Otherwise produce a request error requiring {operationName}.
44+
* Otherwise raise a request error requiring {operationName}.
4545
* Otherwise:
4646
* Let {operation} be the Operation named {operationName} in {document}.
47-
* If {operation} was not found, produce a request error.
47+
* If {operation} was not found, raise a request error.
4848
* Return {operation}.
4949

5050

@@ -92,14 +92,14 @@ CoerceVariableValues(schema, operation, variableValues):
9292
* Add an entry to {coercedValues} named {variableName} with the
9393
value {defaultValue}.
9494
* Otherwise if {variableType} is a Non-Nullable type, and either {hasValue}
95-
is not {true} or {value} is {null}, throw a request error.
95+
is not {true} or {value} is {null}, raise a request error.
9696
* Otherwise if {hasValue} is true:
9797
* If {value} is {null}:
9898
* Add an entry to {coercedValues} named {variableName} with the
9999
value {null}.
100100
* Otherwise:
101101
* If {value} cannot be coerced according to the input coercion
102-
rules of {variableType}, throw a request error.
102+
rules of {variableType}, raise a request error.
103103
* Let {coercedValue} be the result of coercing {value} according to the
104104
input coercion rules of {variableType}.
105105
* Add an entry to {coercedValues} named {variableName} with the
@@ -253,7 +253,7 @@ CreateSourceEventStream(subscription, schema, variableValues, initialValue):
253253
* Let {selectionSet} be the top level Selection Set in {subscription}.
254254
* Let {groupedFieldSet} be the result of
255255
{CollectFields(subscriptionType, selectionSet, variableValues)}.
256-
* If {groupedFieldSet} does not have exactly one entry, throw a request error.
256+
* If {groupedFieldSet} does not have exactly one entry, raise a request error.
257257
* Let {fields} be the value of the first entry in {groupedFieldSet}.
258258
* Let {fieldName} be the name of the first entry in {fields}.
259259
Note: This value is unaffected if an alias is used.
@@ -340,7 +340,7 @@ is explained in greater detail in the Field Collection section below.
340340

341341
**Errors and Non-Null Fields**
342342

343-
If during {ExecuteSelectionSet()} a field with a non-null {fieldType} throws a
343+
If during {ExecuteSelectionSet()} a field with a non-null {fieldType} raises a
344344
field error then that error must propagate to this entire selection set, either
345345
resolving to {null} if allowed or further propagated to a parent field.
346346

@@ -590,7 +590,7 @@ CoerceArgumentValues(objectType, field, variableValues):
590590
* Add an entry to {coercedValues} named {argumentName} with the
591591
value {defaultValue}.
592592
* Otherwise if {argumentType} is a Non-Nullable type, and either {hasValue}
593-
is not {true} or {value} is {null}, throw a field error.
593+
is not {true} or {value} is {null}, raise a field error.
594594
* Otherwise if {hasValue} is true:
595595
* If {value} is {null}:
596596
* Add an entry to {coercedValues} named {argumentName} with the
@@ -600,7 +600,7 @@ CoerceArgumentValues(objectType, field, variableValues):
600600
value {value}.
601601
* Otherwise:
602602
* If {value} cannot be coerced according to the input coercion
603-
rules of {argumentType}, throw a field error.
603+
rules of {argumentType}, raise a field error.
604604
* Let {coercedValue} be the result of coercing {value} according to the
605605
input coercion rules of {argumentType}.
606606
* Add an entry to {coercedValues} named {argumentName} with the
@@ -645,12 +645,12 @@ CompleteValue(fieldType, fields, result, variableValues):
645645
* Let {innerType} be the inner type of {fieldType}.
646646
* Let {completedResult} be the result of calling
647647
{CompleteValue(innerType, fields, result, variableValues)}.
648-
* If {completedResult} is {null}, throw a field error.
648+
* If {completedResult} is {null}, raise a field error.
649649
* Return {completedResult}.
650650
* If {result} is {null} (or another internal value similar to {null} such as
651651
{undefined}), return {null}.
652652
* If {fieldType} is a List type:
653-
* If {result} is not a collection of values, throw a field error.
653+
* If {result} is not a collection of values, raise a field error.
654654
* Let {innerType} be the inner type of {fieldType}.
655655
* Return a list where each list item is the result of calling
656656
{CompleteValue(innerType, fields, resultItem, variableValues)}, where
@@ -716,13 +716,13 @@ MergeSelectionSets(fields):
716716

717717
### Errors and Non-Nullability
718718

719-
If an error is thrown while resolving a field, it should be treated as though
719+
If an error is raised while resolving a field, it should be treated as though
720720
the field returned {null}, and an error must be added to the {"errors"} list
721721
in the response.
722722

723723
If the result of resolving a field is {null} (either because the function to
724724
resolve the field returned {null} or because an error occurred), and that
725-
field is of a `Non-Null` type, then a field error is thrown. The
725+
field is of a `Non-Null` type, then a field error is raised. The
726726
error must be added to the {"errors"} list in the response.
727727

728728
If the field returns {null} because of an error which has already been added to

spec/Section 7 -- Response.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22

33
When a GraphQL service receives a request, it must return a well-formed
44
response. The service's response describes the result of executing the requested
5-
operation if successful, and describes any errors encountered during the
6-
request.
5+
operation if successful, and describes any errors raised during the request.
76

8-
A response may contain both a partial response as well as encountered errors in
9-
the case that a field error occurred on a field which was replaced with {null}.
7+
A response may contain both a partial response as well as any field errors in
8+
the case that a field error was raised on a field and was replaced with {null}.
109

1110
## Request Errors
1211

13-
Any errors that occur during a GraphQL request are termed "request errors."
14-
Request errors are not limited to errors that occur during execution of the
12+
Any errors raised during a GraphQL request are termed "request errors."
13+
Request errors are not limited to errors that were raised during execution of the
1514
operation, they could be raised during parsing and validation of the request
1615
too. For example, a request error will be raised if the request does not
1716
contain sufficient information to indicate uniquely which operation to execute.
@@ -20,9 +19,9 @@ contain sufficient information to indicate uniquely which operation to execute.
2019

2120
A response to a GraphQL request must be a map.
2221

23-
If the request encountered any errors, the response map must contain an
22+
If the request raised any errors, the response map must contain an
2423
entry with key `errors`. The value of this entry is described in the "Errors"
25-
section. If the operation completed without encountering any errors, this entry
24+
section. If the operation completed without raising any errors, this entry
2625
must not be present.
2726

2827
If the request included execution, the response map must contain an entry
@@ -50,10 +49,10 @@ requested operation. If the operation was a query, this output will be an
5049
object of the schema's query root type; if the operation was a mutation, this
5150
output will be an object of the schema's mutation root type.
5251

53-
If an error was encountered before execution begins, the `data` entry should
52+
If an error was raised before execution begins, the `data` entry should
5453
not be present in the result.
5554

56-
If an error was encountered during the execution that prevented a valid
55+
If an error was raised during the execution that prevented a valid
5756
response, the `data` entry in the response should be `null`.
5857

5958

@@ -62,17 +61,17 @@ response, the `data` entry in the response should be `null`.
6261
The `errors` entry in the response is a non-empty list of errors, where each
6362
error is a map.
6463

65-
If no errors were encountered during the request, the `errors` entry should
64+
If no errors were raised during the request, the `errors` entry should
6665
not be present in the result.
6766

6867
If the `data` entry in the response is not present, the `errors`
6968
entry in the response must not be empty. It must contain at least one error.
7069
The errors it contains should indicate why no data was able to be returned.
7170

7271
If the `data` entry in the response is present (including if it is the value
73-
{null}), the `errors` entry in the response may contain any errors that
74-
occurred during execution. If errors occurred during execution, it should
75-
contain those errors.
72+
{null}), the `errors` entry in the response may contain any field errors that
73+
were raised during execution. If field errors were raised during execution, it
74+
should contain those errors.
7675

7776
**Error result format**
7877

@@ -149,7 +148,7 @@ The response might look like:
149148
If the field which experienced an error was declared as `Non-Null`, the `null`
150149
result will bubble up to the next nullable field. In that case, the `path`
151150
for the error should include the full path to the result field where the error
152-
occurred, even if that field is not present in the response.
151+
was raised, even if that field is not present in the response.
153152

154153
For example, if the `name` field from above had declared a `Non-Null` return
155154
type in the schema, the result would look different but the error reported would

0 commit comments

Comments
 (0)