1 | import { isNonEmptyArray } from "./arrays.js";
|
2 | import { isExecutionPatchIncrementalResult } from "./incrementalResult.js";
|
3 | export function graphQLResultHasError(result) {
|
4 | var errors = getGraphQLErrorsFromResult(result);
|
5 | return isNonEmptyArray(errors);
|
6 | }
|
7 | export 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 |
|
\ | No newline at end of file |