Skip to content

Commit b765f23

Browse files
committed
no EPR on leaf value as errors throw
1 parent 20d2089 commit b765f23

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/execution/execute.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ function completeValue(
10161016
// If field type is a leaf type, Scalar or Enum, serialize to a valid value,
10171017
// returning null if serialization is not possible.
10181018
if (isLeafType(returnType)) {
1019-
return completeLeafValue(returnType, result);
1019+
return { data: completeLeafValue(returnType, result) };
10201020
}
10211021

10221022
// If field type is an abstract type, Interface or Union, determine the
@@ -1119,10 +1119,7 @@ function flattenEPRs(
11191119
* Complete a Scalar or Enum by serializing to a valid value, returning
11201120
* null if serialization is not possible.
11211121
*/
1122-
function completeLeafValue(
1123-
returnType: GraphQLLeafType,
1124-
result: mixed,
1125-
): ExecutionPartialResult<mixed> {
1122+
function completeLeafValue(returnType: GraphQLLeafType, result: mixed): mixed {
11261123
invariant(returnType.serialize, 'Missing serialize method on type');
11271124
const serializedResult = returnType.serialize(result);
11281125
if (isInvalid(serializedResult)) {
@@ -1131,7 +1128,7 @@ function completeLeafValue(
11311128
`received: ${String(result)}`,
11321129
);
11331130
}
1134-
return { data: serializedResult };
1131+
return serializedResult;
11351132
}
11361133

11371134
/**

0 commit comments

Comments
 (0)