Java, Class-specific Exceptions vs. Standard Exceptions

前端 未结 6 1810
北恋
北恋 2021-02-07 12:42

I\'ve been updating an existing library to throw exceptions to help improve debugging by people using the library.

At first, I thought I\'d define exceptions specific to

6条回答
  •  滥情空心
    2021-02-07 13:09

    Trade-off? A lot of work, a lot of code to maintain and time is money. I'd suggest: define new exceptions only if you need them for filtering logs, fine grained exception handling or debugging (set a breakpoint for a special exception type).

提交回复
热议问题