Skip to content

Commit 3aec24e

Browse files
committed
no EPR on leaf value as errors throw
1 parent 1543d02 commit 3aec24e

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
@@ -1011,7 +1011,7 @@ function completeValue(
10111011
// If field type is a leaf type, Scalar or Enum, serialize to a valid value,
10121012
// returning null if serialization is not possible.
10131013
if (isLeafType(returnType)) {
1014-
return completeLeafValue(returnType, result);
1014+
return { data: completeLeafValue(returnType, result) };
10151015
}
10161016

10171017
// If field type is an abstract type, Interface or Union, determine the
@@ -1114,10 +1114,7 @@ function flattenEPRs(
11141114
* Complete a Scalar or Enum by serializing to a valid value, returning
11151115
* null if serialization is not possible.
11161116
*/
1117-
function completeLeafValue(
1118-
returnType: GraphQLLeafType,
1119-
result: mixed,
1120-
): ExecutionPartialResult<mixed> {
1117+
function completeLeafValue(returnType: GraphQLLeafType, result: mixed): mixed {
11211118
invariant(returnType.serialize, 'Missing serialize method on type');
11221119
const serializedResult = returnType.serialize(result);
11231120
if (isInvalid(serializedResult)) {
@@ -1126,7 +1123,7 @@ function completeLeafValue(
11261123
`received: ${String(result)}`,
11271124
);
11281125
}
1129-
return { data: serializedResult };
1126+
return serializedResult;
11301127
}
11311128

11321129
/**

0 commit comments

Comments
 (0)