peladodocinero
There is a problem with Dto's background. Soy new, for favor ayuda :))
I have my Product entity and IProductService in my Domain layer. The problem is that by implementing ProductService in my Application layer, I need to return the DTO that is in Application as well. How do I make the IProductoService method found in Domain return a DTO if it is in the Application layer?
This is the ProductService method where I need to return the DTO.
21 replies
The best way to handle Errors in Clean Arch
Hello, everything okay? I have a question. I want to know what is the best way to handle errors in my application using Clean Architecture. To put you in context, I am creating a layered API, that is, there is the Infrastructure that contains the repository and the application layer that contains the service. The logic goes in the service, for example, when a user registers and their username has at least 6 characters, then it throws an error that is ArgumentException with a message:
Now, in the controller, what is the best way to handle those errors? Why does it always return a status code of 500, while the error could be 401? Also, how do I resolve the message? Thank you so much. I leave you images so that you can put yourself in context.
44 replies