简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM