@graphql-tools/executor-http 2.0.0 → 2.0.1-alpha-dba19b626fc57f79ef0854d734972f1cd7a69ce1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @graphql-tools/executor-http
2
2
 
3
+ ## 2.0.1-alpha-dba19b626fc57f79ef0854d734972f1cd7a69ce1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1121](https://github.com/graphql-hive/gateway/pull/1121) [`dba19b6`](https://github.com/graphql-hive/gateway/commit/dba19b626fc57f79ef0854d734972f1cd7a69ce1) Thanks [@enisdenjo](https://github.com/enisdenjo)! - Gracefully handle event stream reading errors and cancellations
8
+
3
9
  ## 2.0.0
4
10
 
5
11
  ### Major Changes
package/dist/index.cjs CHANGED
@@ -422,7 +422,24 @@ function handleEventStreamResponse(response, subscriptionCtrl, signal) {
422
422
  if (!body?.locked) {
423
423
  return stop();
424
424
  }
425
- const { done, value: chunk } = await reader.read();
425
+ let done, chunk;
426
+ try {
427
+ const result = await reader.read();
428
+ done = result.done;
429
+ chunk = result.value;
430
+ } catch (err) {
431
+ if (signal?.aborted) {
432
+ await push(createResultForAbort(signal.reason));
433
+ return stop();
434
+ }
435
+ const errErr = err instanceof Error ? err : new Error(String(err));
436
+ await push({
437
+ errors: [
438
+ utils.createGraphQLError(errErr.message, { originalError: errErr })
439
+ ]
440
+ });
441
+ return stop();
442
+ }
426
443
  if (done) {
427
444
  return stop();
428
445
  }
package/dist/index.js CHANGED
@@ -420,7 +420,24 @@ function handleEventStreamResponse(response, subscriptionCtrl, signal) {
420
420
  if (!body?.locked) {
421
421
  return stop();
422
422
  }
423
- const { done, value: chunk } = await reader.read();
423
+ let done, chunk;
424
+ try {
425
+ const result = await reader.read();
426
+ done = result.done;
427
+ chunk = result.value;
428
+ } catch (err) {
429
+ if (signal?.aborted) {
430
+ await push(createResultForAbort(signal.reason));
431
+ return stop();
432
+ }
433
+ const errErr = err instanceof Error ? err : new Error(String(err));
434
+ await push({
435
+ errors: [
436
+ createGraphQLError(errErr.message, { originalError: errErr })
437
+ ]
438
+ });
439
+ return stop();
440
+ }
424
441
  if (done) {
425
442
  return stop();
426
443
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-tools/executor-http",
3
- "version": "2.0.0",
3
+ "version": "2.0.1-alpha-dba19b626fc57f79ef0854d734972f1cd7a69ce1",
4
4
  "type": "module",
5
5
  "description": "A set of utils for faster development of GraphQL tools",
6
6
  "repository": {
@@ -56,7 +56,7 @@
56
56
  "extract-files": "13.0.0",
57
57
  "graphql": "^16.9.0",
58
58
  "graphql-yoga": "^5.13.4",
59
- "pkgroll": "2.12.1"
59
+ "pkgroll": "2.12.2"
60
60
  },
61
61
  "sideEffects": false
62
62
  }