summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorStephen D. Huston <shuston@apache.org>2009-10-05 23:19:53 +0000
committerStephen D. Huston <shuston@apache.org>2009-10-05 23:19:53 +0000
commit87258f571db29fa78f257281d3cfa1d1bd62a01a (patch)
tree46816497282904b970b6f7c87f190a712be229cd /cpp/src
parent26807ff14fbf19158397eff97d38883b62e56ebc (diff)
downloadqpid-python-87258f571db29fa78f257281d3cfa1d1bd62a01a.tar.gz
Improve ability to avoid dialogs in automated tests
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@822086 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/tests/windows/DisableWin32ErrorWindows.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/cpp/src/tests/windows/DisableWin32ErrorWindows.cpp b/cpp/src/tests/windows/DisableWin32ErrorWindows.cpp
index d51ed90758..a0b665db73 100644
--- a/cpp/src/tests/windows/DisableWin32ErrorWindows.cpp
+++ b/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