|
-
Dec 10th, 2008, 11:19 AM
#1
Thread Starter
Fanatic Member
[2008] Comprehensive error handling for jmcilhinney's data access samples
I'd like to request recommended error handling code for jmcilhinney's data access samples
Thanks for any help
-
Dec 10th, 2008, 07:00 PM
#2
Re: [2008] Comprehensive error handling for jmcilhinney's data access samples
1. Look at the members I use and then read the documentation for those members and see what exceptions they can throw.
2. Look at the situations that can cause those exceptions to be thrown and ask yourself whether that situation could reasonably occur in your app.
3. For those exceptions that could reasonably occur, wrap the code in a Try block and Catch the exception.
4. For blocks that can throw more than one type of exception AND you want to process those exceptions differently, add multiple Catch blocks.
5. Make sure that, if one section of code depends on another, the second section will not execute if the first throws an exception, e.g. don't call ExecuteReader if calling Open on your connection threw an exception.
Those are basically the rules of exception handling for any code. So, how about you try following them and show us the result?
-
Dec 10th, 2008, 09:10 PM
#3
Thread Starter
Fanatic Member
Re: [2008] Comprehensive error handling for jmcilhinney's data access samples
Sure thing. Will post the code asap.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|