You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
795 B
19 lines
795 B
4 months ago
|
import { isNonEmptyArray } from "./arrays.js";
|
||
|
import { isExecutionPatchIncrementalResult } from "./incrementalResult.js";
|
||
|
export function graphQLResultHasError(result) {
|
||
|
var errors = getGraphQLErrorsFromResult(result);
|
||
|
return isNonEmptyArray(errors);
|
||
|
}
|
||
|
export function getGraphQLErrorsFromResult(result) {
|
||
|
var graphQLErrors = isNonEmptyArray(result.errors) ? result.errors.slice(0) : [];
|
||
|
if (isExecutionPatchIncrementalResult(result) &&
|
||
|
isNonEmptyArray(result.incremental)) {
|
||
|
result.incremental.forEach(function (incrementalResult) {
|
||
|
if (incrementalResult.errors) {
|
||
|
graphQLErrors.push.apply(graphQLErrors, incrementalResult.errors);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
return graphQLErrors;
|
||
|
}
|
||
|
//# sourceMappingURL=errorHandling.js.map
|