Click to See Complete Forum and Search --> : How can I handle errors that do not throw any Exceptions??


Samantha
March 30th, 1999, 08:30 AM
Can anyone guide me as to how to handle errors that do not throw any exception.

For example, I frequently get errors from CStringArray.GetAt() function when it goes out of bound. I gave this only for example as they can be hanled by a proper if construct. But still there may be some overlooks. So can anyone guide me as to how to catch such type of errors.


and also to use set_terminate() function.


Thanks and Love in advance,

Samantha Katherine.

Once and Future Consultant
March 30th, 1999, 09:47 AM
Let's see if I understand the question: How do you handle error conditions that are

not detected, is that it?

Wes Rogers
March 31st, 1999, 03:22 PM
Dear Samantha,


First, congratulations on even bothering to try and catch the exceptions that ARE thrown! There is an awful lot of production code is out there that doesn't worry about it.


Unfortunately, if a function does not throw exceptions, it is up to you to trap the condition.


Now, on IBM-type mainframes, you can have an "ESTAE" exit that the OS jumps into when it hits an abend condition, so at least you can shut down gracefully under all conditions (short of the operator pressing the IPL button). I've never found the equivalent for Windows -- but it may be out there somewhere.


Also, don't let sarcastic replies get to you. Just ignore them as best you can, and keep using the site.


Yours,

Wes Rogers

S Cheeran
March 31st, 1999, 10:20 PM
Samantha,

An innocent reply, as in olden dos times can you safely overload(remembering threading) the interrupts like overflow, divide by zero etc. Try, the processor is the same whether it is dos or windows and it can execute interrupts also, but how don't know. I have seen couple of int 3 in MFC code. If you can you have the solution.

Hochgebe
June 11th, 1999, 04:36 PM
If I have the question correct.... Are these errors supposed to be debugging tools? As in halt the program?

If I have the question correct, then you are using the code for debuging and program termination.

Try the Assert function. It even reports the line number of the error!!

You can look it up in the index, but I think that the library is standard, and that it has the format

Assert( condition )

if the condition evaluates to true, the program ends, otherwise it continues normally.
This is a great debugging and error handling tool! And I commend you on attempting to capture such errors! This is great programming practice!

you will have to specify the condition, however.

///////////////////////////////////////////////////////
Good things come to those who wait...
But they come used by the impatient....
///////////////////////////////////////////////////////