@graphql-tools/utils
Version:
Common package containing utils and types for GraphQL tools
18 lines (17 loc) • 568 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.toLoadError = toLoadError;
exports.shouldCollectLoadErrors = shouldCollectLoadErrors;
exports.createFailedSource = createFailedSource;
function toLoadError(error) {
return error instanceof Error ? error : new Error(String(error));
}
function shouldCollectLoadErrors(errorHandling) {
return errorHandling === 'aggregate' || errorHandling === 'return';
}
function createFailedSource(location, error) {
return {
location,
error: toLoadError(error),
};
}