should one pass errors as exceptions to the UI code in a winforms applicaiton?
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.
精彩评论