diff options
| author | Aidan Skinner <aidan@apache.org> | 2009-10-11 23:22:08 +0000 |
|---|---|---|
| committer | Aidan Skinner <aidan@apache.org> | 2009-10-11 23:22:08 +0000 |
| commit | 98cc985dbd81a84cd0b0a969c57cb941680ec81f (patch) | |
| tree | a9060c1f208897cbd9dd4791b29202c78566993b /qpid/cpp/src/tests/windows/DisableWin32ErrorWindows.cpp | |
| parent | 788f96fd8af146cba5bff57300b1a513988c34b9 (diff) | |
| download | qpid-python-98cc985dbd81a84cd0b0a969c57cb941680ec81f.tar.gz | |
Merge from trunk
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/java-network-refactor@824198 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/windows/DisableWin32ErrorWindows.cpp')
| -rw-r--r-- | qpid/cpp/src/tests/windows/DisableWin32ErrorWindows.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/qpid/cpp/src/tests/windows/DisableWin32ErrorWindows.cpp b/qpid/cpp/src/tests/windows/DisableWin32ErrorWindows.cpp index d51ed90758..a0b665db73 100644 --- a/qpid/cpp/src/tests/windows/DisableWin32ErrorWindows.cpp +++ b/qpid/cpp/src/tests/windows/DisableWin32ErrorWindows.cpp @@ -28,9 +28,23 @@ #include <crtdbg.h> #include <windows.h> +#include <iostream> namespace { +// Instead of popping up a window for exceptions, just print something out +LONG _stdcall UnhandledExceptionFilter (PEXCEPTION_POINTERS pExceptionInfo) +{ + DWORD dwExceptionCode = pExceptionInfo->ExceptionRecord->ExceptionCode; + + if (dwExceptionCode == EXCEPTION_ACCESS_VIOLATION) + std::cerr << "\nERROR: ACCESS VIOLATION\n" << std::endl; + else + std::cerr << "\nERROR: UNHANDLED EXCEPTION\n" << std::endl; + + return EXCEPTION_EXECUTE_HANDLER; +} + struct redirect_errors_to_stderr { redirect_errors_to_stderr (); }; @@ -50,6 +64,9 @@ redirect_errors_to_stderr::redirect_errors_to_stderr() // and can't-open-file message boxes. SetErrorMode(SEM_FAILCRITICALERRORS); SetErrorMode(SEM_NOOPENFILEERRORBOX); + + // And this will catch all unhandled exceptions. + SetUnhandledExceptionFilter (&UnhandledExceptionFilter); } } // namespace |
