Files
Odoo-GraphQL-Subscription-C…/graphql-subscription/node_modules/@apollo/client/utilities/common/errorHandling.js
2024-06-03 20:23:50 +05:30

19 lines
795 B
JavaScript

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