@graphql-tools/executor-http 1.3.3 → 1.3.4-alpha-37f7f3f98b6a592c6655b659b959139bbb3129d0
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 +6 -0
- package/dist/index.cjs +7 -3
- package/dist/index.js +7 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @graphql-tools/executor-http
|
|
2
2
|
|
|
3
|
+
## 1.3.4-alpha-37f7f3f98b6a592c6655b659b959139bbb3129d0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1015](https://github.com/graphql-hive/gateway/pull/1015) [`c2a45c0`](https://github.com/graphql-hive/gateway/commit/c2a45c0957e41d506c7b6459cccf47dfaef63c58) Thanks [@ardatan](https://github.com/ardatan)! - Add `TypeError` to `originalError` prop of the error thrown when no `data` and `errors` found in the HTTP response, then GraphQL Servers know that it is an unexpected error so it should be masked and logged separately instead of leaking to the client
|
|
8
|
+
|
|
3
9
|
## 1.3.3
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -728,11 +728,13 @@ function buildHTTPExecutor(options) {
|
|
|
728
728
|
const parsedResult = JSON.parse(result);
|
|
729
729
|
upstreamErrorExtensions.response.body = parsedResult;
|
|
730
730
|
if (parsedResult.data == null && (parsedResult.errors == null || parsedResult.errors.length === 0)) {
|
|
731
|
+
const message = `Unexpected empty "data" and "errors" fields in result: ${result}`;
|
|
731
732
|
return {
|
|
732
733
|
errors: [
|
|
733
734
|
utils.createGraphQLError(
|
|
734
|
-
|
|
735
|
+
message,
|
|
735
736
|
{
|
|
737
|
+
originalError: new Error(message),
|
|
736
738
|
extensions: upstreamErrorExtensions
|
|
737
739
|
}
|
|
738
740
|
)
|
|
@@ -772,10 +774,12 @@ function buildHTTPExecutor(options) {
|
|
|
772
774
|
};
|
|
773
775
|
}
|
|
774
776
|
} else {
|
|
777
|
+
const message = "No response returned";
|
|
775
778
|
return {
|
|
776
779
|
errors: [
|
|
777
|
-
utils.createGraphQLError(
|
|
778
|
-
extensions: upstreamErrorExtensions
|
|
780
|
+
utils.createGraphQLError(message, {
|
|
781
|
+
extensions: upstreamErrorExtensions,
|
|
782
|
+
originalError: new Error(message)
|
|
779
783
|
})
|
|
780
784
|
]
|
|
781
785
|
};
|
package/dist/index.js
CHANGED
|
@@ -726,11 +726,13 @@ function buildHTTPExecutor(options) {
|
|
|
726
726
|
const parsedResult = JSON.parse(result);
|
|
727
727
|
upstreamErrorExtensions.response.body = parsedResult;
|
|
728
728
|
if (parsedResult.data == null && (parsedResult.errors == null || parsedResult.errors.length === 0)) {
|
|
729
|
+
const message = `Unexpected empty "data" and "errors" fields in result: ${result}`;
|
|
729
730
|
return {
|
|
730
731
|
errors: [
|
|
731
732
|
createGraphQLError(
|
|
732
|
-
|
|
733
|
+
message,
|
|
733
734
|
{
|
|
735
|
+
originalError: new Error(message),
|
|
734
736
|
extensions: upstreamErrorExtensions
|
|
735
737
|
}
|
|
736
738
|
)
|
|
@@ -770,10 +772,12 @@ function buildHTTPExecutor(options) {
|
|
|
770
772
|
};
|
|
771
773
|
}
|
|
772
774
|
} else {
|
|
775
|
+
const message = "No response returned";
|
|
773
776
|
return {
|
|
774
777
|
errors: [
|
|
775
|
-
createGraphQLError(
|
|
776
|
-
extensions: upstreamErrorExtensions
|
|
778
|
+
createGraphQLError(message, {
|
|
779
|
+
extensions: upstreamErrorExtensions,
|
|
780
|
+
originalError: new Error(message)
|
|
777
781
|
})
|
|
778
782
|
]
|
|
779
783
|
};
|
package/package.json
CHANGED