UNPKG

811 BJavaScriptView Raw
1import { isNonEmptyArray } from "./arrays.js";
2import { isExecutionPatchIncrementalResult } from "./incrementalResult.js";
3export function graphQLResultHasError(result) {
4 var errors = getGraphQLErrorsFromResult(result);
5 return isNonEmptyArray(errors);
6}
7export function getGraphQLErrorsFromResult(result) {
8 var graphQLErrors = isNonEmptyArray(result.errors)
9 ? result.errors.slice(0)
10 : [];
11 if (isExecutionPatchIncrementalResult(result) &&
12 isNonEmptyArray(result.incremental)) {
13 result.incremental.forEach(function (incrementalResult) {
14 if (incrementalResult.errors) {
15 graphQLErrors.push.apply(graphQLErrors, incrementalResult.errors);
16 }
17 });
18 }
19 return graphQLErrors;
20}
21//# sourceMappingURL=errorHandling.js.map
\No newline at end of file