I am trying to use an external C++ library which have defined its exceptions as:
enum MY_ERRORS { ERR_NONE = 0, ERR_T1, ERR_T2, }; Then in the code exceptions are thrown like this:
if(...) { throw ERR_T1; Being new to programming in C++, I would do something like:
try { call_to_external_library(); } catch(??? err) { printf("An error occurred: %s\n", err); } catch(...) { printf("An unexpected exception occurred.\n"); } How do I determine what was thrown?
errshould beMY_ERRORSorconst MY_ERRORS&or something like this (doesn't matter much forenums). In thecatch( ... )you cannot get the type of the caught exception