simple-command-bus
Version:
Simple Command Bus
29 lines (19 loc) • 721 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _lodash = require('lodash');
var _createException = require('./createException');
var _createException2 = _interopRequireDefault(_createException);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var InvalidCommand = (0, _createException2.default)('InvalidCommand', {
message: 'Invalid Command'
});
InvalidCommand.forCommand = function (command) {
var message = null;
if ((0, _lodash.isObject)(command)) {
message = 'Command ' + command.constructor.name + ' is invalid. It must extend from Command.';
}
throw new InvalidCommand(message);
};
exports.default = InvalidCommand;