From 056fb764923d19b997acd14ef4109800beb5a63c Mon Sep 17 00:00:00 2001
From: Tim Mickel <tim.mickel@gmail.com>
Date: Mon, 13 Jun 2016 11:23:39 -0400
Subject: [PATCH] Remove try/catch in execution - fix #75

---
 src/engine/execute.js | 50 ++++++++++++++++++-------------------------
 1 file changed, 21 insertions(+), 29 deletions(-)

diff --git a/src/engine/execute.js b/src/engine/execute.js
index d2f8381f0..0d1dbc3cc 100644
--- a/src/engine/execute.js
+++ b/src/engine/execute.js
@@ -58,37 +58,29 @@ var execute = function (sequencer, thread) {
         console.log('and stack frame: ', currentStackFrame);
     }
     var primitiveReturnValue = null;
-    try {
-        // @todo deal with the return value
-        primitiveReturnValue = blockFunction(argValues, {
-            yield: thread.yield.bind(thread),
-            done: function() {
-                sequencer.proceedThread(thread);
-            },
-            timeout: YieldTimers.timeout,
-            stackFrame: currentStackFrame,
-            startSubstack: function (substackNum) {
-                sequencer.stepToSubstack(thread, substackNum);
-            }
-        });
-    }
-    catch(e) {
-        console.error(
-            'Exception calling block function for opcode: ' +
-            opcode + '\n' + e);
-    } finally {
-        // Update if the thread has set a yield timer ID
-        // @todo hack
-        if (YieldTimers.timerId > oldYieldTimerId) {
-            thread.yieldTimerId = YieldTimers.timerId;
+    // @todo deal with the return value
+    primitiveReturnValue = blockFunction(argValues, {
+        yield: thread.yield.bind(thread),
+        done: function() {
+            sequencer.proceedThread(thread);
+        },
+        timeout: YieldTimers.timeout,
+        stackFrame: currentStackFrame,
+        startSubstack: function (substackNum) {
+            sequencer.stepToSubstack(thread, substackNum);
         }
-        if (DEBUG_BLOCK_CALLS) {
-            console.log('ending stack frame: ', currentStackFrame);
-            console.log('returned: ', primitiveReturnValue);
-            console.groupEnd();
-        }
-        return primitiveReturnValue;
+    });
+    // Update if the thread has set a yield timer ID
+    // @todo hack
+    if (YieldTimers.timerId > oldYieldTimerId) {
+        thread.yieldTimerId = YieldTimers.timerId;
     }
+    if (DEBUG_BLOCK_CALLS) {
+        console.log('ending stack frame: ', currentStackFrame);
+        console.log('returned: ', primitiveReturnValue);
+        console.groupEnd();
+    }
+    return primitiveReturnValue;
 };
 
 module.exports = execute;