Why throw again in CPPExceptionTerminate #439
Water-bamboo opened this issue · 1 comments
If I comment blow code, it still works, blow 'throw' neccesary?
try { throw; } catch(std::exception& exc) { strncpy(descriptionBuff, exc.what(), sizeof(descriptionBuff)); } #define CATCH_VALUE(TYPE, PRINTFTYPE) \ catch(TYPE value)\ { \ snprintf(descriptionBuff, sizeof(descriptionBuff), "%" #PRINTFTYPE, value); \ } CATCH_VALUE(char, d) CATCH_VALUE(short, d) CATCH_VALUE(int, d) CATCH_VALUE(long, ld) CATCH_VALUE(long long, lld) CATCH_VALUE(unsigned char, u) CATCH_VALUE(unsigned short, u) CATCH_VALUE(unsigned int, u) CATCH_VALUE(unsigned long, lu) CATCH_VALUE(unsigned long long, llu) CATCH_VALUE(float, f) CATCH_VALUE(double, f) CATCH_VALUE(long double, Lf) CATCH_VALUE(char*, s) catch(...) { description = NULL; }
Could you clarify what you mean by "it still works"?
Typically, in the context of handling uncaught exceptions, you wouldn't expect the process to continue running normally after an uncaught exception occurs. Normally, the throw;
rethrows the current uncaught exception, allowing the subsequent catch
blocks to capture and log the exception's details. This is crucial because CPPExceptionTerminate
does not have direct access to the exception otherwise.