I am using a thirdparty library eg. Lib::ValueType value. I then do a call to a member function, value.theta() which performs some mathematical operations including a call to atan2 from <cmath>. Sometimes the theta component is empty and an “atan2: domain error” is thrown. However, I can’t catch the exception even by wrapping try{}catch(...) around the suspect code.
I am using C++ Builder 2009, any idea as to how the exception is being thrown and not being caught by the IDE, or my code. The error pops straight up to the screen as a dialog. I have selected all the options in the IDE to handle everytype of exception.
The C standard library isn’t aware of C++ exception handling, so
try-catchwon’t work. You might want to look at the matherr function – according to the documentation, you can redefine this function in your program in order to handle math exceptions by yourself.