|
-
Jun 19th, 2013, 11:00 PM
#1
Thread Starter
Hyperactive Member
Why is it "bad" to only have an exception catch block?
I know with exceptions that many times you want to catch specific types and do different actions depending on which one occurs. For example, if there is an IndexoutofBounds exception you might want to log and continue the app but if you have a Network exception of some type you might want to log and stop the app. But here is my question. Often times I need to take the same exact action no matter what type of exception occurs. Mostly with my apps, I log the exception and redirect to an error page. Therefore I usually have just one exception catch block, so that it catches all types of exceptions and does the same actions. I have read/heard many say that is bad. Why is it bad? What is my alternative? I couldn't possibly list out every type of exception type in catch blocks and repeat the same actions in each block? That is insane.
Could someone give me their advise? Thanks.
Remember to click on the scales to the left and rep me if I helped 
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
|