Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Exception Handling in n-tier application
Message
De
26/03/2008 13:09:15
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
 
 
À
26/03/2008 12:33:58
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 8.0
Divers
Thread ID:
01305376
Message ID:
01305795
Vues:
6
Thanks for the info!

>Hey Mike,
>
>Have you seen these two posts from Thread #1301455?
>
>Message #1301541 and Message #1302428
>
>~~Bonnie
>
>
>
>>>I have been reading a few MS books and they seem to have different advice on how to handle Exceptions in a n-tier application. The Microsoft 70-536 training guide states that all code besides simple variable declarations should be included within a Try Catch block. The Framework Design Guidelines from the Microsoft Development Series states that only exceptions where you have explicit procedures to handle the specific error, and that you should never catch a base type Exception, rather, you should have the application crash.
>>>
>>>I understand the basic functionality of Exception Handling, but I am trying to find the best way do it. Before I had all of the code in the DataAccess class wrapped in a Try Catch block, where if it was a base Exception I would rethrow the exception. I would do the same thing in the BusinessLogic class, and in my UI class I would have all of the code wrapped in Try Catch blocks, but handling the exceptions appropriately. This seems to be the wrong way to go about this.
>>>
>>>Can somebody explain their Exception Handling framework? Thanks!
>>
>>It seems like part of my problem was that when I was rethrowing the exception, I would use Throw ex (which actually repackages the exception) instead of simply Throw. This keeps the original stack trace intact, which helps big time. This also seems to fit nicely in the my existing scheme. However, I still don't understand the comment that discourages from catching a generic Exception.
Very fitting: http://xkcd.com/386/
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform