graphile-build
Version:
Build a GraphQL schema from plugins
28 lines (27 loc) • 786 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var SwallowErrorsPlugin = function SwallowErrorsPlugin(builder, {
dontSwallowErrors = false
}) {
builder.hook("build", build => {
if (dontSwallowErrors) {
// This plugin is a bit of a misnomer - to better maintain backwards
// compatibility, `swallowError` still exists on `makeNewBuild`; and
// thus this plugin is really `dontSwallowErrors`.
return Object.assign(build, {
swallowError(e) {
// $FlowFixMe
e.recoverable = true;
throw e;
}
});
} else {
return build;
}
}, ["SwallowErrors"]);
};
exports.default = SwallowErrorsPlugin;
//# sourceMappingURL=SwallowErrorsPlugin.js.map