@deliverr/serverless-offline-step-functions
Version:
Serverless Offline Plugin to Support Step Functions for Local Development
26 lines (25 loc) • 731 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Catchers = void 0;
const Catcher_1 = require("./Catcher");
class Catchers {
constructor(_catchers) {
this._catchers = _catchers;
}
static create(taskCatchRules) {
const catchers = taskCatchRules.map((taskCatchRule) => {
return Catcher_1.Catcher.create(taskCatchRule);
});
return new Catchers(catchers);
}
getCatcherBasedOn(statesErrors) {
const catcher = this._catchers.find((catcher) => {
return catcher.includesSomeOf(statesErrors);
});
if (!catcher) {
return;
}
return catcher;
}
}
exports.Catchers = Catchers;