diff options
author | Chris Wilson <chris+github@qwirx.com> | 2010-03-18 21:40:43 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2010-03-18 21:40:43 +0000 |
commit | 8edbcdfa70b41fb3ad5beedd5108f635de5f9c10 (patch) | |
tree | 611627063ee9d5e7f509c373b1265e3d350da28f /lib/common/Database.h | |
parent | 63895eb8b5e6ab148fa3480fdc28cc68c59dae98 (diff) |
Add header with macros for QDBM error logging.
Diffstat (limited to 'lib/common/Database.h')
-rw-r--r-- | lib/common/Database.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/common/Database.h b/lib/common/Database.h new file mode 100644 index 00000000..94239ab8 --- /dev/null +++ b/lib/common/Database.h @@ -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 |