From e5393e5448c239a40368f6b043ffe28ea23a64cb Mon Sep 17 00:00:00 2001
From: Nicolas Noble <pixel@nobis-crew.org>
Date: Mon, 5 Aug 2013 14:19:41 -0700
Subject: Don't crash Dalos if there's an error that appears while running
 interactive strings.

---
 src/Dalos-cli.cc | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/Dalos-cli.cc b/src/Dalos-cli.cc
index ae4806c..acc7ea3 100644
--- a/src/Dalos-cli.cc
+++ b/src/Dalos-cli.cc
@@ -104,6 +104,16 @@ void MainTask::Do() {
 
         LuaExecString luaExecString(line_read);
         luaExecString.exec(luaMainTask);
-        luaExecString.throwError();
+        try {
+            luaExecString.throwError();
+        }
+        catch (GeneralException & e) {
+            const char * details = e.getDetails();
+            if (details)
+                Printer::log(M_WARNING, "  %s", details);
+            auto trace = e.getTrace();
+            for (String & str : trace)
+                Printer::log(M_DEBUG, "%s", str.to_charp());
+        }
     }
 }
-- 
cgit v1.2.3