What should be the best Exception Handling Strategy

后端 未结 7 2018
逝去的感伤
逝去的感伤 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条回答
  •  闹比i
    闹比i (楼主)
    2021-02-14 08:15

    When you design a multi-tier application, you should keep in mind that those tiers can be distributed, maybe hosted within different services on different machines, thus making it necessary to throw exceptions through remote boundaries which is not a very preferable way to do. In such a case, catching them and just bubbling some sort of error message or code is a better way in my opinion. Additionally you should allways trace the exception when you catch it. Its always good to know whats going on in your application.

提交回复
热议问题