Where to put try catch

前端 未结 11 689
一整个雨季
一整个雨季 2020-12-09 03:51

Consider this scenario: I have 3-layer app, when the user click on the button the button event handler calls a method in biz layer that do whatever with data my button even

11条回答
  •  臣服心动
    2020-12-09 04:35

    UI is just for presentation. You don't catch exceptions there, because figuring out what to do with it means logic. That belongs in business or controller layers. At worst, you catch the exception and map it to an appropriate, user-friendly error message that is then sent to the presentation for display.

提交回复
热议问题