aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/parser.h
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2013-06-03 12:20:52 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2014-02-15 18:38:24 +0100
commit707acef9b3b83a1ecf945a40e14d83cce947b766 (patch)
treee4501baa2cfb1e4d380da034df32ad407b2c4478 /src/parser.h
parent8046e11445ba71b767d4fde08ce1e43e0dcd0359 (diff)
downloadsciteco-707acef9b3b83a1ecf945a40e14d83cce947b766.tar.gz
added State::StdError class for constructing errors from std::exception objects
Diffstat (limited to 'src/parser.h')
-rw-r--r--src/parser.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/parser.h b/src/parser.h
index 8e73d64..f29ea38 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -18,6 +18,9 @@
#ifndef __PARSER_H
#define __PARSER_H
+#include <exception>
+#include <typeinfo>
+
#include <glib.h>
#include <glib/gprintf.h>
@@ -156,6 +159,14 @@ public:
void display_full(void);
};
+ class StdError : public Error {
+ public:
+ StdError(const gchar *type, const std::exception &error)
+ : Error("%s: %s", type, error.what()) {}
+ StdError(const std::exception &error)
+ : Error("%s: %s", typeid(error).name(), error.what()) {}
+ };
+
class GError : public Error {
public:
GError(const ::GError *gerror)