What should be the best Exception Handling Strategy

后端 未结 7 2015
逝去的感伤
逝去的感伤 2021-02-14 07:28

I am working on application where user invokes a method from UI , on this I am calling a method from business class which calls another methods

UI--> Method1 -->Method2

7条回答
  •  我在风中等你
    2021-02-14 08:27

    If you can't recover from the exception in the method where the exception happens, don't try to catch it (unless you want to log it, in which case throw it again after logging). Then catch at the UI-level.

    Trying to catch exceptions at every level just adds bloat to your code.

提交回复
热议问题