nestjs / cqrs

A lightweight CQRS module for Nest framework (node.js) :balloon:
https://nestjs.com
MIT License
828 stars 150 forks source link

CommandHandleException with Command Name not command uuid #1491

Open Dracks opened 1 year ago

Dracks commented 1 year ago

Is there an existing issue that is already proposing this?

Is your feature request related to a problem? Please describe it

Currently, we are having some random problems with the commandHandler that nestjs doesn't found the commandHandler, and this trigger the CommandHandlerException with an UUID, which makes it super dificult to debug.

Describe the solution you'd like

I would like that on the following line: https://github.com/nestjs/cqrs/blob/master/src/command-bus.ts#L61

The name passed to the exception is the real name of the class, and not the ID. Currently I needed to go to the sourcecode in production, look at the line of the exception to search what command was failing.

Teachability, documentation, adoption, migration strategy

No response

What is the motivation / use case for changing the behavior?

Makes thinks easy to debug, I replicated a similar error here: https://codesandbox.io/p/sandbox/exciting-wildflower-kqx3ky

And you can see the error is not really user friendly, If I had 4 or 5 commands, and after a refactor I get that error, It's not straight forward.

kamilmysliwiec commented 1 year ago

Would you like to create a PR for this issue?

Dracks commented 1 year ago

I will try it. Give me some time.