Hi all,
Why is catch(Exception) always a bad idea or good idea when we use it in project?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Andrew FensterPosted Jul 19, 2011, 10:23 AM
When you catch your exceptions, you can write a message to an error log. You can clean up your data, so you don't crash half way through a process. You can display an error message to the user, so he will know whether his update went through before the crash. You can shut down the application in the manner of your choice, instead of just crashing.
If you record your exceptions to an error log, it makes it much easier to know when and why your application is throwing exceptions.
If you're getting paid to write code, you absolutely have to catch your exceptions.
sunakshi saxenaPosted Jul 19, 2011, 2:04 PM
you can refer below article for better understanding of catch(Exception) is good or bad.
http://heathesh.com/post/2010/02/01/Good-and-bad-exception-(error)-handling.aspx
Please mark as accepted answer if you like it.
Thanks
Sunakshi Saxena
VulpesPosted Jul 19, 2011, 3:32 AM
Vilas GitePosted Jul 19, 2011, 1:09 AM
Catch exception always good for handling exception and easy to find out exception type or error message. Good programmer always use catch exception in their projects. Its good habit to use it.. so, i recommend you use it in project....
In this regard there are good articles in our community site.. so refer it form "Our recommended articles' .
---------------------------------------------------------------------------------------------------
If this reply helps your post…then check "This is correct answer"
MarcusPosted Jul 19, 2011, 1:01 AM