[repl] add error handling for async scope fetching
authorFedor Indutny <fedor.indutny@gmail.com>
Sun, 11 Sep 2011 14:52:24 +0000 (21:52 +0700)
committerRyan Dahl <ry@tinyclouds.org>
Wed, 14 Sep 2011 03:40:21 +0000 (20:40 -0700)
lib/repl.js

index cc9b227..27eeaf5 100644 (file)
@@ -405,7 +405,9 @@ REPLServer.prototype.complete = function(line, callback) {
           completionGroupsLoaded();
         } else {
           this.eval('.scope', this.context, 'repl', function(err, globals) {
-            if (Array.isArray(globals[0])) {
+            if (err || !globals) {
+              addStandardGlobals();
+            } else if (Array.isArray(globals[0])) {
               // Add grouped globals
               globals.forEach(function(group) {
                 completionGroups.push(group);