Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Exception Handling
Message
From
13/04/2007 11:20:59
John Baird
Coatesville, Pennsylvania, United States
 
 
To
13/04/2007 10:38:05
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB.NET 1.1
Miscellaneous
Thread ID:
01215534
Message ID:
01215563
Views:
18
This message has been marked as the solution to the initial question of the thread.
>What is a good way to do exception handling? I read in a book that everything excluding simple variable declarations should be in a Try Catch block. This make sense to me on the GUI side, but how about in the other tiers? Should I be including all code in my business classes and Data classes in Try Catch blocks? I tried this and it seems like it is overkill, as I usually end up just rethrowing the exception (sometimes multiple times) and letting the GUI handle it.
>
>What does everybody else do?


IMHO, you should wrap anything in your business classes and data classes in TryCatch blocks that require any outside input (like SQL, directories, imports, exports, xml, etc.). These exceptions are caught and rethrown to the parent calling method in the UI which should handle them or pass them further up the chain.

I just had a conversation with a gentlemen and one of our local user's groups and he was under the opinion that all errors should be handled without rethrowing them higher in the UI. I think they should be handled where it makes sense.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform