Skip to content

Commit c3db89d

Browse files
committed
Subscriptions: make validation errors non-terminal
1 parent 1c842af commit c3db89d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

apollo-execution-runtime/src/commonMain/kotlin/com/apollographql/execution/ExecutableSchema.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class ExecutableSchema(
4444
): Flow<SubscriptionEvent> {
4545
return prepareRequest(schema, coercings, persistedDocumentCache, request).fold(
4646
ifLeft = {
47-
flowOf(SubscriptionError(it))
47+
flowOf(SubscriptionResponse(GraphQLResponse.Builder().errors(it).build()))
4848
},
4949
ifRight = {
5050
operationContext(it, executionContext).subscribe()

apollo-execution-runtime/src/commonMain/kotlin/com/apollographql/execution/SubscriptionEvent.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@ class SubscriptionResponse(val response: GraphQLResponse) : SubscriptionEvent
1818
* This event is terminal and the client can decide whether to retry or give up.
1919
* For convenience, [SubscriptionError] uses the same error type as the GraphQL errors but these are not in the same domain. Another server
2020
* implementation could decide to use something else.
21+
*
22+
* Example: validation error
2123
*/
2224
class SubscriptionError(val errors: List<Error>) : SubscriptionEvent

0 commit comments

Comments
 (0)