Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Exception Handling
Message
De
18/04/2007 11:22:40
 
 
À
13/04/2007 11:20:59
John Baird
Coatesville, Pennsylvanie, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB.NET 1.1
Divers
Thread ID:
01215534
Message ID:
01217327
Vues:
16
I'm late to this conversation, but I wanted to add something:

For server-side stuff, we don't pass the exception back through to the UI (because we have an intervening Web Service in between the layers). What we do for server-side errors is to log the error message in the Windows Event Log, then use a message parameter to pass the error message back through to the UI. The UI can then do something with that info if it needs to.

~~Bonnie




>>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.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform