summaryrefslogtreecommitdiff
path: root/utils.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2008-07-31 06:24:45 -0400
committerJohn Wiegley <johnw@newartisans.com>2008-07-31 06:24:45 -0400
commit99313ebc6c3779f692f9f1bd70cc69a236f5eb78 (patch)
tree44a553891a9aaa148084d8e011b2d326401343e9 /utils.h
parent8afd926a27af55862ce360970e05d747f249a0da (diff)
downloadledger-99313ebc6c3779f692f9f1bd70cc69a236f5eb78.tar.gz
ledger-99313ebc6c3779f692f9f1bd70cc69a236f5eb78.tar.bz2
ledger-99313ebc6c3779f692f9f1bd70cc69a236f5eb78.zip
Revised the way that exceptions are thrown around. Instead of context being a
complicated string of pointers, it's now just a global block of text that gets appended to as the error is being thrown up, and can be displayed at the catch point if desired. There are almost no cases where a thrown exception will not result in an error message being displayed to the user.
Diffstat (limited to 'utils.h')
-rw-r--r--utils.h48
1 files changed, 4 insertions, 44 deletions
diff --git a/utils.h b/utils.h
index 05a214a7..60d47ec1 100644
--- a/utils.h
+++ b/utils.h
@@ -463,53 +463,13 @@ void finish_timer(const char * name);
/**********************************************************************
*
- * Exception handling
+ * - Exception handling helpers
+ * - Date/time support classes
+ * - General support for objects with "flags"
+ * - Support for scoped execution and variable restoration
*/
#include "error.h"
-
-namespace ledger {
-
-extern std::ostringstream _exc_buffer;
-
-template <typename T>
-inline void throw_func(const std::string& message) {
- _exc_buffer.str("");
- throw T(message);
-}
-
-#define throw_(cls, msg) \
- ((_exc_buffer << msg), throw_func<cls>(_exc_buffer.str()))
-
-#if 0
-inline void throw_unexpected_error(char c, char wanted) {
- if (c == -1) {
- if (wanted)
- throw new error(string("Missing '") + wanted + "'");
- else
- throw new error("Unexpected end of input");
- } else {
- if (wanted)
- throw new error(string("Invalid char '") + c +
- "' (wanted '" + wanted + "')");
- else
- throw new error(string("Invalid char '") + c + "'");
- }
-}
-#else
-inline void throw_unexpected_error(char, char) {
-}
-#endif
-
-} // namespace ledger
-
-/**********************************************************************
- *
- * Date/time support classes
- * General support for objects with "flags"
- * Support for scoped execution and variable restoration
- */
-
#include "times.h"
#include "flags.h"
#include "pushvar.h"