Where to put try catch

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

    definitely put a try catch closest to the user -- because in that location you can translate it into something meaningful for your user.

    Deeper try catches could only be needed if you intend to do something with them -- for example, handle the exception, or perhaps log and rethrow the exception.

提交回复
热议问题