Bryan wrote:
I have an unknown error in some legacy code. I can catch it with catch
(...), but I cannot tell what kind of error it is.
Is there any base exception class (like in java) that I can try and
catch that might give me some more meaningful information? Or
suggestions on the most common exceptions so I can just try them?
Thanks,
Bryan
The ellipsis indicates that the catch clause doesn't care what kind of
exception it has caught. Its purpose is to to catch every exception. By
the time this catch clause executes, it's too late to wonder what kind
of exception was thrown. Because if the thrown type really were of
interest, it should have already been caught.
Generally, when the type of a thrown exception can vary, a C++ program
will declare a series of catch clauses with the ellipsis catch-all
coming last:
catch (std::exception & InException)
{
...
}
catch (int inOSErr)
{
...
}
catch (...) // for thrown types not already caught
{
...
}
Greg