C++ Exceptions and Catch-All Handlers
-
I am using try{}catch(...) handlers extensively to handle all types of exceptions that are thrown. In particular, I am catching hardware exceptions such as access violations and so on. How can I find out exactly what hardware exception occurred within the catch(...) handler? Do I have to use SEH to do this?
-
I am using try{}catch(...) handlers extensively to handle all types of exceptions that are thrown. In particular, I am catching hardware exceptions such as access violations and so on. How can I find out exactly what hardware exception occurred within the catch(...) handler? Do I have to use SEH to do this?
Does
std::exception::what()
help you? Or do you need to differtiate the exception objects at runtime and react on their type? Thentypeid
may help you (look for RTTI in MSDN)to determine the type of the exception-object you caught. But maybe you simply can replace the catch(...) with a list of catches for the exception classes you need.
My opinions may have changed, but not the fact that I am right.
-
I am using try{}catch(...) handlers extensively to handle all types of exceptions that are thrown. In particular, I am catching hardware exceptions such as access violations and so on. How can I find out exactly what hardware exception occurred within the catch(...) handler? Do I have to use SEH to do this?
DaGlynn wrote: Do I have to use SEH to do this? I think so. Below is a link to the code that I use in all my applications to do this: http://www.codeproject.com/cpp/seexception.asp?target=seh[^] John
-
I am using try{}catch(...) handlers extensively to handle all types of exceptions that are thrown. In particular, I am catching hardware exceptions such as access violations and so on. How can I find out exactly what hardware exception occurred within the catch(...) handler? Do I have to use SEH to do this?
DaGlynn wrote: Do I have to use SEH to do this? according to the docs, yes. You can use GetExceptionInformation() to do that - but this can be called only insode the __except() filter
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen