Why is it a bad idea to throw your own exceptions?

Answers were Sorted based on User's Feedback



Why is it a bad idea to throw your own exceptions?..

Answer / pradeep

Hi Swapna,

throwing our Own Exception does not Means that there is
Design Flaws,

Assume that your application Involves DB Operation,

EG:

It Reads Data from an MSACCESS file,

and you are connecting the D.B through you program,

but can u tell me, what will happen if somebody/some other
application Exclusively opened the Access file before ur
Program,
----------------
A wise Programmer will foresee this Issue, and will Create
his own Exception Handler, which will instruct his User to
close that MSACCESS file,

----

So SWAPNA pls Grow UP, and try to think like how MEN Do,..

Is This Answer Correct ?    2 Yes 0 No

Why is it a bad idea to throw your own exceptions?..

Answer / swapna

if at that point you know that an error has occurred, then
why not write the proper code to handle that error instead
of passing a new Exception object to the catch block?

Throwing your own exceptions signifies some design flaws in
the project.

Is This Answer Correct ?    1 Yes 1 No

Why is it a bad idea to throw your own exceptions?..

Answer / shirshak

Both of you are correct. Don't fight like two cats for a
chapati or a monkey will take away your chapati

Is This Answer Correct ?    0 Yes 0 No

Why is it a bad idea to throw your own exceptions?..

Answer / raj

Hi pradeep
if your DB can be opened by other program or application
then what is the security in it

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Sharp Interview Questions

Is c# code is managed or unmanaged code?

0 Answers  


What is the difference between a variable and a literal?

0 Answers  


What is alias in c#?

0 Answers  


7. C# provides a default constructor for me. I write a constructor that takes a string as a parameter, but want to keep the no parameter one. How many constructors should I write?

2 Answers  


Is it possible to inherit multiple interfaces?

0 Answers   Siebel,






What is a ienumerator?

0 Answers  


Explain the three test cases in unit testing?

0 Answers   Siebel,


Difference between StackPanel and RelativePanel ?

0 Answers   HCL,


which access modifier we can declare the abstract class?

5 Answers   IBM,


Can you instantiate a struct without using a new operator in c#?

0 Answers  


Show us in simple steps to create setup & deployment project for windows application?

0 Answers   QuestPond,


What are the Different kinds of methods?

4 Answers   Wipro,


Categories