Skip to content

Commit b9c3047

Browse files
smyrickmabuyo
andauthored
[docs] Add GraphQL-spec error codes (#8150)
Co-authored-by: Michelle Mabuyo <[email protected]>
1 parent 6eeadde commit b9c3047

File tree

1 file changed

+34
-18
lines changed

1 file changed

+34
-18
lines changed

docs/source/routing/errors.mdx

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,41 @@ You can create Rhai scripts that throw custom status codes. See [Terminating cli
7171

7272
</Note>
7373

74-
## GraphQL error codes
74+
## GraphQL spec error codes
7575

76-
GraphQL error codes can appear in client responses under `errors[].extensions.code`, which is an established convention found in [GraphQL error extensions](https://spec.graphql.org/October2021/#sec-Errors.Error-result-format). Learn how to see these error codes in Studio via [extended error metrics](/graphos/routing/graphos-reporting#enabling-extended-error-reporting).
76+
These error codes are defined in the [GraphQL spec](https://spec.graphql.org/October2021/) and can appear in client responses under `errors[].extensions.code`, which is an established convention found in [GraphQL error extensions](https://spec.graphql.org/October2021/#sec-Errors.Error-result-format). Because these error codes are part of the core spec, you can't disable them. Only Apollo Router-specific features or subgraph errors can be disabled.
77+
78+
Changing these errors makes your router non-compliant with the GraphQL spec. If you need to change these errors, you need to use an external system, such as an HTTP proxy layer.
79+
80+
Learn how to see these error codes in Studio with [extended error reporting](/graphos/routing/graphos-reporting#enabling-extended-error-reporting).
81+
82+
<PropertyList kind="errCodes">
83+
84+
85+
<Property name="GRAPHQL_VALIDATION_FAILED">
86+
87+
The operation failed during GraphQL validation.
88+
89+
</Property>
90+
<Property name="GRAPHQL_UNKNOWN_OPERATION_NAME">
91+
92+
The operation could not be executed because the operation name was invalid or
93+
did not match an operation in the query document.
94+
95+
</Property>
96+
<Property name="PARSING_ERROR">
97+
98+
The operation could not be parsed as GraphQL.
99+
100+
</Property>
101+
102+
</PropertyList>
103+
104+
## Apollo Router error codes
105+
106+
Additional error codes can appear in client responses under `errors[].extensions.code`, which is an established convention found in [GraphQL error extensions](https://spec.graphql.org/October2021/#sec-Errors.Error-result-format). Learn how to see these error codes in Studio with [extended error reporting](/graphos/routing/graphos-reporting#enabling-extended-error-reporting).
107+
108+
You can suppress or disable these error codes using [router customizations](/graphos/routing/customization/overview).
77109

78110
<PropertyList kind="errCodes">
79111

@@ -112,17 +144,6 @@ The response from a subgraph did not match the GraphQL schema.
112144

113145
The request timed out when fetching data from a connector service.
114146

115-
</Property>
116-
<Property name="GRAPHQL_VALIDATION_FAILED">
117-
118-
The operation failed during GraphQL validation.
119-
120-
</Property>
121-
<Property name="GRAPHQL_UNKNOWN_OPERATION_NAME">
122-
123-
The operation could not be executed because the operation name was invalid or
124-
did not match an operation in the query document.
125-
126147
</Property>
127148
<Property name="HTTP_CLIENT_ERROR">
128149

@@ -154,11 +175,6 @@ The operation was not executed due to exceeding the `max_root_fields` limit.
154175

155176
The operation was not executed because safelisting is enabled and the freeform GraphQL document provided was not found in the persisted query safelist.
156177

157-
</Property>
158-
<Property name="PARSING_ERROR">
159-
160-
The operation could not be parsed as GraphQL.
161-
162178
</Property>
163179
<Property name="PERSISTED_QUERY_HASH_MISMATCH">
164180

0 commit comments

Comments
 (0)