AhmedShabaanHelwa / PackItKata

Kata of DevMentors: Mini Course #1 Clean Architecture + CQRS
0 stars 0 forks source link

PackIt Solution: Support customized exceptions. #10

Closed AhmedShabaanHelwa closed 2 years ago

AhmedShabaanHelwa commented 2 years ago

This is achieved by adding PackItExceptionBase class. to PackIt.Shared.Abstractions project.

Recall that customized exceptions are useful as:

  1. It facilitates business understanding and testing. Built-in exceptions are useful indeed, but they are thrown everywhere in the stack so that tracking sources of exceptions are challengeable. On the other hand, Customized exceptions can be self-explanatory through their names.
  2. Despite performance issues related to exceptions, but in DDD exceptions are helpful in restricting business rules; making the objects self-validated and compliant with rules consistencies. e.g; The advantage of stop execution due to exception prevents the error from propagating to any other depending layer.