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 510710 1f686d42d43ebd73b045dd16d1c167a0ed3e55f7
parent 510709 b7e4f51b79a9c739be5e661025fd7e3534031073
child 510711 bc9a09046f1b83752004d6a4a9b54f06386a5e63
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [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;
     }
 }