Where to put try catch

前端 未结 11 661
一整个雨季
一整个雨季 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:48

    It just depends on where you actually want to do something about it. Generally I catch it in the business layer, and then log it and possibly call some ui function to display a message to the user.

    I consider what to do with errors a business rule. It should be separate from the data layer or ui layer.

提交回复
热议问题