What is your custom exception hierrarchy?
- by bonefisher
My question is: how would you create exception hierarchy in your application?
Designing the architecture of an application,
from my perspective, we could have three types of exceptions:
the built-in (e.g.: InvalidOperationException)
custom internal system faults (DB transaction failed on commit, DbTransactionFailedException)
custom business exceptions (BusinessRuleViolationException)
Class hierarchy:
Exception
MyAppInternalException
DbTransactionFailedException
MyServerTimeoutException
...
MyAppBusinessRuleViolationException
UsernameAlreadyExistsException
...
where only MyAppInternalException & MyAppBusinessRuleViolationException would be catched.