import { isNonEmptyArray } from "./arrays.js";
import { isExecutionPatchIncrementalResult } from "./incrementalResult.js";
export function graphQLResultHasError(result) {
    const errors = getGraphQLErrorsFromResult(result);
    return isNonEmptyArray(errors);
}
export function getGraphQLErrorsFromResult(result) {
    const graphQLErrors = isNonEmptyArray(result.errors) ? result.errors.slice(0) : [];
    if (isExecutionPatchIncrementalResult(result) &&
        isNonEmptyArray(result.incremental)) {
        result.incremental.forEach((incrementalResult) => {
            if (incrementalResult.errors) {
                graphQLErrors.push(...incrementalResult.errors);
            }
        });
    }
    return graphQLErrors;
}
//# sourceMappingURL=errorHandling.js.map
