Skip to content

Commit

Permalink
feat(): Improve command bus to throw error with command name
Browse files Browse the repository at this point in the history
  • Loading branch information
jsinglamms committed Sep 18, 2023
1 parent f0d75e1 commit a990d62
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/command-bus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ export class CommandBus<CommandBase extends ICommand = ICommand>
const commandId = this.getCommandId(command);
const handler = this.handlers.get(commandId);
if (!handler) {
throw new CommandHandlerNotFoundException(commandId);
throw new CommandHandlerNotFoundException(
Object.getPrototypeOf(command).constructor.name,
);
}
this._publisher.publish(command);
return handler.execute(command);
Expand Down

0 comments on commit a990d62

Please sign in to comment.