matthewrenze / clean-architecture-demo

A sample app for my online course "Clean Architecture: Patterns, Practices, and Principles" in .NET Framework 4.8
BSD 3-Clause "New" or "Revised" License
1.04k stars 482 forks source link

Throw a calls-stack details Exceptions Msg when Calling Service (WebApi) project 'Sale By Id=5' endpoints which(SaleId=5) is not existed at Sales DB table #14

Closed tutul2010 closed 11 months ago

tutul2010 commented 11 months ago

Hi @matthewrenze ,

Thanks for your wonderful PS course and code repo. I am playing around urs code base and found a handle exception which were showing at swagger page, That Exception Msg was not properly handled in sale middleware-application layer code . Testcase (Negative ) Calling API End-points -https://localhost:7001/api/sales/5 Above SaleId=5 was not present at Sales DB table and thrown a calls-stack exception msg at swagger page as response. It should be handle in code and return a friendly Msg as response. Attached Screenshot as below image

Thanks again for code.

Regards, Tutul

matthewrenze commented 11 months ago

Tutul,

Thank you for pointing out the missing exception handling.

To keep the code as simple as possible, for teaching purposes, I intentionally left out exception handling, logging, authentication, validation, etc. While I would expect all of these aspects to be present in a real-world production application, they were outside of the scope of the topics I was specifically trying to teach in this course.

So, if it's alright with you, I'll close this open issue -- since I do not plan to implement exception handling in this educational project. However, we'll leave this closed issue with our conversation available here for others who may have the same question or concern.

Thanks!

Matthew