Search code examples
c#exceptionenterprise-libraryn-tier-architecture

exception handling application block


what are the disadvantages of not using exception handling application block or any other unified exception handling library. The only thing I can think of is that code will end up with different type of Try/Catch all over the place depending upon the developer. How can lack of planning in this regard, cause real world problems down the line?


Solution

  • I've recently began reading up on this topic myself. My basic understanding is:

    1. Only catch an exception if you plan to handle it.
    2. Overuse of try/catch can lead to exception swallowing and/or the loss of valuable stack trace information and can lead to maintainability issues (what if you decide to standardize your errors/logging?). Instead use try/finally or using blocks to implement clean up.
    3. Catch exceptions at the boundaries via a global exception handler.

    Again, this is just what I've gathered initially. I think short answer to your question is maintainability and the potential loss of valuable trace information. Below are some sources:

    Good Exception Management Rules of Thumb

    Understanding and Using Exceptions