aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index 8921942..f64b246 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -21,6 +21,7 @@
#include <stdarg.h>
#include <string.h>
+#include <stdexcept>
#include <glib.h>
#include <glib/gprintf.h>
@@ -83,10 +84,16 @@ Execute::step(const gchar *macro, gint stop_pos)
#endif
try {
- if (interface.is_interrupted())
- throw State::Error("Interrupted");
-
- State::input(macro[macro_pc]);
+ /* convert bad_alloc 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 (State::Error &error) {
error.pos = macro_pc;
String::get_coord(macro, error.pos,