From 707acef9b3b83a1ecf945a40e14d83cce947b766 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Mon, 3 Jun 2013 12:20:52 +0200 Subject: added State::StdError class for constructing errors from std::exception objects --- src/parser.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/parser.h') 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 +#include + #include #include @@ -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) -- cgit v1.2.3