15 #ifndef INCG_IRIS_IUTEST_EXCEPTION_HPP_B73B2E25_97C8_4DFC_BC32_5E53039A1A64_
16 #define INCG_IRIS_IUTEST_EXCEPTION_HPP_B73B2E25_97C8_4DFC_BC32_5E53039A1A64_
21 #if IUTEST_HAS_EXCEPTIONS
35 inline ::std::string FormatCxxException(
const char* description)
38 if( description != NULL )
40 strm <<
"C++ exception with description \"" << description <<
"\"";
44 strm <<
"Unknown C++ exception";
62 class seh_exception :
public ::std::exception
65 seh_exception() : ::std::exception() {}
66 explicit seh_exception(
const char *
const& what) : ::std::exception(what) {}
68 static void translator(DWORD code, _EXCEPTION_POINTERS* ep)
70 IUTEST_UNUSED_VAR(ep);
72 #if IUTEST_HAS_IOMANIP
73 strm <<
"SEH exception with code 0x" << ::std::setbase(16) << code;
75 strm <<
"SEH exception with code " << code;
77 throw seh_exception(strm.str().c_str());
79 static int should_process_through_break_and_cppexceptions(DWORD code)
81 bool should_handle =
true;
83 if( code == EXCEPTION_BREAKPOINT )
84 should_handle =
false;
85 if( code == kCxxExceptionCode )
86 should_handle =
false;
87 return should_handle ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH;
90 static const DWORD kCxxExceptionCode = 0xe06d7363;
94 void seh_passthrough(T func)
96 _EXCEPTION_POINTERS* ep = NULL;
101 __except( ep = GetExceptionInformation()
102 , seh_exception::should_process_through_break_and_cppexceptions(GetExceptionCode()) )
104 seh_exception::translator(GetExceptionCode(), ep);
iutest root namespace
Definition: iutest_charcode.hpp:33