Is exception handling useful in
compile time errors
logical errors
and even runtime errors?

Recommended Answers

All 6 Replies

Exception handling is not useful for compile-time errors.

It should NOT be used for logic errors.

It should be used for runtime errors where something is completely out of your control.

commented: As a vb.noob, .i completely Agree.:) +12

Exception handling is not useful for compile-time errors.

It should NOT be used for logic errors.

It should be used for runtime errors where something is completely out of your control.

we can use even for logical errors...isnt it?
suppose we have
dim a as integer=10
dim b as integer=0
dim c as integer
c=a/b
as this is logical error we use exception handlers to handle this
which means that we are using even to handle logical errors.

It would be MUCH better to test for zero and not divide by it than to let an exception occur. If you can predict it or prevent it, do so with code.

Exception processing is costly if your program is to continue running (doesn't just exit on the first exception).

A lot of coding is about control. The first step of maintaining control is ensure you have it in the first place :)

It would be MUCH better to test for zero and not divide by it than to let an exception occur. If you can predict it or prevent it, do so with code.

Exception processing is costly if your program is to continue running (doesn't just exit on the first exception).

A lot of coding is about control. The first step of maintaining control is ensure you have it in the first place :)

ok thanks for the reply..
And finally exception handling process is a costly one ...
Is this the final conclusion why u asked me to test for zero rather than dividing it?

>>Is this the final conclusion why u asked me to test for zero rather than dividing it?
.i think so As well.
reason: Running the Try/Catch/etc., it sends the p.c. into shock Not just your tiny little app.

Hope this helps.:)

>>Is this the final conclusion why u asked me to test for zero rather than dividing it?
.i think so As well.
reason: Running the Try/Catch/etc., it sends the p.c. into shock Not just your tiny little app.

Hope this helps.:)

yes thanks
the problem is solved..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.