Catch (Exception)

Why is catch (Exception) almost always a bad idea?

Questions by narens.form

Showing Answers 1 - 5 of 5 Answers

Since System.Excception will handle all the exception,  you should catch the exact exception types that you expect because these are the types your code is prepared to handle

  Was this answer useful?  Yes

using "catch"  - its shrinks the performance of programmer
suppose if a programmer has to execute a value divided by zero its shows a overflow exception. so inorder to reduce this problem in a simple manner progm'rs using a "catch" handler.

  Was this answer useful?  Yes

goconog

  • Aug 8th, 2011
 

Why are Catch (exceptions) bad? Somebody rate my answer! Because it starts at the TOP of the Exceptions hierarchy, and catches them ALL where you really only want to catch the exceptions that your program can reasonably handle. Usage error or logical errors can usually be handled but not system failures. Thus, you need to have the exact exception you need instead of ALL of them. This means using a specific catch handler.

  Was this answer useful?  Yes

Charushila Kedar

  • Oct 25th, 2011
 

in try block we write the code of error occurring coding..
To handle this error, program needs an handler to this error., So, we can handle this by using Catch handler

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions