Is there a way to determine the exception type even know you caught the exception with a catch all?
Example:
try
{
SomeBigFunction();
}
catch(...)
There is no standard, portable way to do this. Here's a non-portable way to do it on GCC and clang
#include
#include
const char* currentExceptionTypeName()
{
int status;
return abi::__cxa_demangle(abi::__cxa_current_exception_type()->name(), 0, 0, &status);
}
int main()
{
try {
throw std::string();
} catch (...) {
std::cout<<"Type of caught exception is "<
Output:
Type of caught exception is std::__cxx11::basic_string, std::allocator >