diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2013-06-03 12:20:52 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2014-02-15 18:38:24 +0100 |
commit | 707acef9b3b83a1ecf945a40e14d83cce947b766 (patch) | |
tree | e4501baa2cfb1e4d380da034df32ad407b2c4478 /src/parser.cpp | |
parent | 8046e11445ba71b767d4fde08ce1e43e0dcd0359 (diff) | |
download | sciteco-707acef9b3b83a1ecf945a40e14d83cce947b766.tar.gz |
added State::StdError class for constructing errors from std::exception objects
Diffstat (limited to 'src/parser.cpp')
-rw-r--r-- | src/parser.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index aed9348..0347146 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -21,7 +21,7 @@ #include <stdarg.h> #include <string.h> -#include <stdexcept> +#include <exception> #include <glib.h> #include <glib/gprintf.h> @@ -88,15 +88,17 @@ Execute::step(const gchar *macro, gint stop_pos) #endif try { - /* convert bad_alloc exceptions */ + /* + * convert bad_alloc and other C++ standard + * library exceptions + */ try { if (interface.is_interrupted()) throw State::Error("Interrupted"); State::input(macro[macro_pc]); - } catch (std::bad_alloc &alloc) { - throw State::Error("bad_alloc: %s", - alloc.what()); + } catch (std::exception &error) { + throw State::StdError(error); } } catch (State::Error &error) { error.pos = macro_pc; |