summaryrefslogtreecommitdiff
path: root/lib/common/Logging.h
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2012-04-28 18:18:59 +0000
committerChris Wilson <chris+github@qwirx.com>2012-04-28 18:18:59 +0000
commit7b5f339fa350511457d84273dc2b122b161a8811 (patch)
tree0f1fdebeb4ea5f313773f4c8f8cf0b489e2002aa /lib/common/Logging.h
parent5818dd9c8233d1454a5f8284ba437ea2f77ee626 (diff)
Allow hiding specific exceptions to keep test output cleaner.
Diffstat (limited to 'lib/common/Logging.h')
-rw-r--r--lib/common/Logging.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/common/Logging.h b/lib/common/Logging.h
index 1fcbe59e..2318e142 100644
--- a/lib/common/Logging.h
+++ b/lib/common/Logging.h
@@ -10,6 +10,8 @@
#ifndef LOGGING__H
#define LOGGING__H
+#include <assert.h>
+
#include <cerrno>
#include <cstring>
#include <iomanip>
@@ -389,6 +391,30 @@ class HideExceptionMessageGuard
bool mOldHiddenState;
};
+class HideSpecificExceptionGuard
+{
+ private:
+ std::pair<int, int> mExceptionCode;
+
+ public:
+ typedef std::vector<std::pair<int, int> > SuppressedExceptions_t;
+ static SuppressedExceptions_t sSuppressedExceptions;
+
+ HideSpecificExceptionGuard(int type, int subtype)
+ : mExceptionCode(std::pair<int, int>(type, subtype))
+ {
+ sSuppressedExceptions.push_back(mExceptionCode);
+ }
+ ~HideSpecificExceptionGuard()
+ {
+ SuppressedExceptions_t::reverse_iterator i =
+ sSuppressedExceptions.rbegin();
+ assert(*i == mExceptionCode);
+ sSuppressedExceptions.pop_back();
+ }
+ static bool IsHidden(int type, int subtype);
+};
+
std::string PrintEscapedBinaryData(const std::string& rInput);
#endif // LOGGING__H