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)
|
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 |
|
\ | No newline at end of file |