On 21 Apr, 22:41, soeren <soe...@[EMAIL PROTECTED]
> wrote:
> Hello,
>
> I'm currently in progress of finding an error that seems to be in my
> system's libraries - but throws an exception at least...
> Currently I don't know what exception type this is but I'm able to
> catch it using a "catch (...)" line. Now I'd like to see what this
> exception is. Is there any way to examine this exception and find out
> what type it is?
Yes. Catch it by the base class, std::exception, and use
the what() function to print the reason:
catch(std::exception& e)
{
std::cerr << "Exception caught: " << e.what() << std::endl;
}
If you are using a Micro$oft platform then this might
not work because Micro$oft compilers tend to translate
conditions such as divide by zero, subscript/index out
of range, underflow/overflow as C++ exceptions, but not
std ones that would inherit from std::exception.
On other platforms these conditions would tend to result
in a signal being raised, which is OS-specific (in Unix
these are signals such as SEGV, EBUS etc, in VMS they are
called traps, etc etc). The Micro$oft behaviour can be
changed by some debugger setting.
Regards,
Andrew Marlow
--
[ See http://www.gotw.ca/resources/clcm.htm
for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


|