simple-command-bus
Version:
Simple Command Bus
19 lines (13 loc) • 463 B
JavaScript
import { isString } from 'lodash';
import createException from './createException';
const MissingHandlerException = createException('MissingHandlerException', {
message: 'Invalid Command'
});
MissingHandlerException.forCommand = (commandName) => {
let message = null;
if (isString(commandName)) {
message = `There is no a handler for "${commandName}" Command.`;
}
throw new MissingHandlerException(message);
};
export default MissingHandlerException;