UNPKG

795 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) ? result.errors.slice(0) : [];
9 if (isExecutionPatchIncrementalResult(result) &&
10 isNonEmptyArray(result.incremental)) {
11 result.incremental.forEach(function (incrementalResult) {
12 if (incrementalResult.errors) {
13 graphQLErrors.push.apply(graphQLErrors, incrementalResult.errors);
14 }
15 });
16 }
17 return graphQLErrors;
18}
19//# sourceMappingURL=errorHandling.js.map
\No newline at end of file