@graphql-tools/executor 1.0.0 → 1.1.0-alpha-20230523100348-6c3466d9
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/cjs/execution/execute.js +14 -1
- package/esm/execution/execute.js +14 -1
- package/package.json +1 -1
package/cjs/execution/execute.js
CHANGED
|
@@ -557,7 +557,20 @@ function completeListItemValue(item, completedResults, errors, exeContext, itemT
|
|
|
557
557
|
* null if serialization is not possible.
|
|
558
558
|
*/
|
|
559
559
|
function completeLeafValue(returnType, result) {
|
|
560
|
-
|
|
560
|
+
let serializedResult;
|
|
561
|
+
// Note: We transform GraphQLError to Error in order to be consistent with
|
|
562
|
+
// how non-null checks work later on.
|
|
563
|
+
// See https://github.com/kamilkisiela/graphql-hive/pull/2299
|
|
564
|
+
// See https://github.com/n1ru4l/envelop/issues/1808
|
|
565
|
+
try {
|
|
566
|
+
serializedResult = returnType.serialize(result);
|
|
567
|
+
}
|
|
568
|
+
catch (err) {
|
|
569
|
+
if (err && typeof err['message'] === 'string') {
|
|
570
|
+
throw new Error(err['message']);
|
|
571
|
+
}
|
|
572
|
+
throw err;
|
|
573
|
+
}
|
|
561
574
|
if (serializedResult == null) {
|
|
562
575
|
throw new Error(`Expected \`${(0, utils_1.inspect)(returnType)}.serialize(${(0, utils_1.inspect)(result)})\` to ` +
|
|
563
576
|
`return non-nullable value, returned: ${(0, utils_1.inspect)(serializedResult)}`);
|
package/esm/execution/execute.js
CHANGED
|
@@ -549,7 +549,20 @@ function completeListItemValue(item, completedResults, errors, exeContext, itemT
|
|
|
549
549
|
* null if serialization is not possible.
|
|
550
550
|
*/
|
|
551
551
|
function completeLeafValue(returnType, result) {
|
|
552
|
-
|
|
552
|
+
let serializedResult;
|
|
553
|
+
// Note: We transform GraphQLError to Error in order to be consistent with
|
|
554
|
+
// how non-null checks work later on.
|
|
555
|
+
// See https://github.com/kamilkisiela/graphql-hive/pull/2299
|
|
556
|
+
// See https://github.com/n1ru4l/envelop/issues/1808
|
|
557
|
+
try {
|
|
558
|
+
serializedResult = returnType.serialize(result);
|
|
559
|
+
}
|
|
560
|
+
catch (err) {
|
|
561
|
+
if (err && typeof err['message'] === 'string') {
|
|
562
|
+
throw new Error(err['message']);
|
|
563
|
+
}
|
|
564
|
+
throw err;
|
|
565
|
+
}
|
|
553
566
|
if (serializedResult == null) {
|
|
554
567
|
throw new Error(`Expected \`${inspect(returnType)}.serialize(${inspect(result)})\` to ` +
|
|
555
568
|
`return non-nullable value, returned: ${inspect(serializedResult)}`);
|