UNPKG

usher

Version:

Simple DSL for composing decision workflows for AWS Simple Workflow

30 lines (21 loc) 589 B
/*! * Usher * Copyright(c) 2014 meltmedia <mike@meltmedia.com> */ 'use strict'; module.exports = ActivityRunner; function ActivityRunner(name, version, activityFn) { if (!(this instanceof ActivityRunner)) { return new ActivityRunner(name, version, activityFn); } this.name = name; this.version = version; this.activityFn = activityFn || function (task) { return task.success(); }; } ActivityRunner.prototype.execute = function execute(task) { try { this.activityFn.call(this, task); } catch (err) { task.failed('UncaughtException', err, false); } };