开发者

should one pass errors as exceptions to the UI code in a winforms applicaiton?

开发者 https://www.devze.com 2022-12-18 00:50 出处:网络
In a winforms application where the UI code calls business methods in my business classes, is it best practice to pass errors back to the UI code as an exception?

In a winforms application where the UI code calls business methods in my business classes, is it best practice to pass errors back to the UI code as an exception?

Also 开发者_开发问答if there are say a couple of main types of exceptions that a particular business method may have, where would it make sense to tailor the text that gets presented to the user for these in the UI?

thanks


Exceptions should be handled at the level they are best dealt with. In most cases this is your user interface; however there are a number of reasons for handling exceptions in your code.

In regards to the user experience of exception messages you'll find an excellent article here on displaying exception/error messages in your WinForms/WPF applications.

0

精彩评论

暂无评论...
验证码 换一张
取 消