No bug. Make jorendb give a REPL even if the script throws an exception. r=NPOAEW
authorSteve Fink <sfink@mozilla.com>
Tue, 08 Jan 2019 14:21:25 -0800
changeset 453607 1f686d42d43e
parent 453606 b7e4f51b79a9
child 453608 bc9a09046f1b
push id35361
push usernbeleuzu@mozilla.com
push dateSat, 12 Jan 2019 09:41:19 +0000
treeherdermozilla-central@a44934afe25e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNPOAEW
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
No bug. Make jorendb give a REPL even if the script throws an exception. r=NPOAEW (Not Part Of Anyone Else's World)
js/examples/jorendb.js
--- a/js/examples/jorendb.js
+++ b/js/examples/jorendb.js
@@ -859,33 +859,37 @@ while(args.length > 0) {
 print("jorendb: scriptPath = " + scriptPath);
 print("jorendb: scriptArgs = " + scriptArgs);
 print("jorendb: actualScriptArgs = " + actualScriptArgs);
 
 for (var task of todo) {
     task['scriptArgs'] = actualScriptArgs;
 }
 
-// If nothing to run, just drop into a repl
-if (todo.length == 0) {
-    todo.push({ 'action': 'repl' });
-}
+// Always drop into a repl at the end. Especially if the main script throws an
+// exception.
+todo.push({ 'action': 'repl' });
 
 while (rerun) {
     print("Top of run loop");
     rerun = false;
     for (var task of todo) {
         activeTask = task;
         if (task.action == 'eval') {
             debuggeeGlobal.eval(task.code);
         } else if (task.action == 'load') {
             debuggeeGlobal['scriptArgs'] = task.scriptArgs;
             debuggeeGlobal['scriptPath'] = task.script;
             print("Loading JavaScript file " + task.script);
-            debuggeeGlobal.evaluate(read(task.script), { 'fileName': task.script, 'lineNumber': 1 });
+            try {
+                debuggeeGlobal.evaluate(read(task.script), { 'fileName': task.script, 'lineNumber': 1 });
+            } catch (exc) {
+                print("Caught exception " + exc);
+                print(exc.stack);
+            }
         } else if (task.action == 'repl') {
             repl();
         }
         if (rerun)
             break;
     }
 }