summaryrefslogtreecommitdiff
path: root/src/error.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/error.h')
-rw-r--r--src/error.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/error.h b/src/error.h
index 568e509a..2c0c4d09 100644
--- a/src/error.h
+++ b/src/error.h
@@ -46,8 +46,11 @@
#ifndef _ERROR_H
#define _ERROR_H
+#include "accum.h"
+
namespace ledger {
+extern straccstream _desc_accum;
extern std::ostringstream _desc_buffer;
template <typename T>
@@ -56,14 +59,20 @@ inline void throw_func(const string& message) {
throw T(message);
}
-#define throw_(cls, msg) \
- ((_desc_buffer << msg), throw_func<cls>(_desc_buffer.str()))
+#define throw_(cls, msg) \
+ ((_desc_buffer << ACCUM(_desc_accum << msg)), \
+ _desc_accum.clear(), \
+ throw_func<cls>(_desc_buffer.str()))
+extern straccstream _ctxt_accum;
extern std::ostringstream _ctxt_buffer;
#define add_error_context(msg) \
((long(_ctxt_buffer.tellp()) == 0) ? \
- (_ctxt_buffer << msg) : (_ctxt_buffer << std::endl << msg))
+ ((_ctxt_buffer << ACCUM(_ctxt_accum << msg)), \
+ _ctxt_accum.clear()) : \
+ ((_ctxt_buffer << std::endl << ACCUM(_ctxt_accum << msg)), \
+ _ctxt_accum.clear()))
string error_context();