[Box Backup-commit] COMMIT r2679 - box/trunk/lib/common

subversion at boxbackup.org subversion at boxbackup.org
Thu Mar 18 21:40:43 GMT 2010


Author: chris
Date: 2010-03-18 21:40:43 +0000 (Thu, 18 Mar 2010)
New Revision: 2679

Added:
   box/trunk/lib/common/Database.h
Log:
Add header with macros for QDBM error logging.


Copied: box/trunk/lib/common/Database.h (from rev 2648, box/trunk/lib/common/Archive.h)
===================================================================
--- box/trunk/lib/common/Database.h	                        (rev 0)
+++ box/trunk/lib/common/Database.h	2010-03-18 21:40:43 UTC (rev 2679)
@@ -0,0 +1,31 @@
+// --------------------------------------------------------------------------
+//
+// File
+//		Name:    Database.h
+//		Purpose: Database (QDBM) utility macros
+//		Created: 2010/03/10
+//
+// --------------------------------------------------------------------------
+
+#ifndef DATABASE__H
+#define DATABASE__H
+
+#include "Logging.h"
+
+#define BOX_DBM_MESSAGE(stuff) stuff << " (qdbm): " << dperrmsg(dpecode)
+
+#define BOX_LOG_DBM_ERROR(stuff) \
+	BOX_ERROR(BOX_DBM_MESSAGE(stuff))
+
+#define THROW_DBM_ERROR(message, filename, exception, subtype) \
+	BOX_LOG_DBM_ERROR(message << ": " << filename); \
+	THROW_EXCEPTION_MESSAGE(exception, subtype, \
+		BOX_DBM_MESSAGE(message << ": " << filename));
+
+#define ASSERT_DBM_OK(operation, message, filename, exception, subtype) \
+	if(!(operation)) \
+	{ \
+		THROW_DBM_ERROR(message, filename, exception, subtype); \
+	}
+
+#endif // DATABASE__H




More information about the Boxbackup-commit mailing list