[Pkg-javascript-commits] [node-module-deps] 231/444: fix to not crash on syntax errors

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 15 09:47:58 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-module-deps.

commit 61e8c4062dce1adbf3356cb5c8b5aa81863b3b56
Author: James Halliday <mail at substack.net>
Date:   Sun May 11 13:01:09 2014 +0000

    fix to not crash on syntax errors
---
 index.js | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/index.js b/index.js
index b131fbe..26af4e8 100644
--- a/index.js
+++ b/index.js
@@ -256,7 +256,7 @@ Deps.prototype.walk = function (id, parent, cb) {
                 .pipe(concat(function (body) {
                     var src = body.toString('utf8');
                     var deps = self.parseDeps(id.file, src);
-                    fromDeps(id.file, src, pkg || {}, deps);
+                    if (deps) fromDeps(id.file, src, pkg || {}, deps);
                 }))
             ;
         });
@@ -277,7 +277,7 @@ Deps.prototype.walk = function (id, parent, cb) {
         self.readFile(file, pkg).pipe(concat(function (body) {
             var src = body.toString('utf8');
             var deps = self.parseDeps(file, src);
-            fromDeps(file, src, pkg, deps);
+            if (deps) fromDeps(file, src, pkg, deps);
         }));
     });
     
@@ -333,9 +333,10 @@ Deps.prototype.parseDeps = function (file, src, cb) {
     try { var deps = detective(src) }
     catch (ex) {
         var message = ex && ex.message ? ex.message : ex;
-        return this.emit('error', new Error(
+        this.emit('error', new Error(
             'Parsing file ' + file + ': ' + message
         ));
+        return;
     }
     return deps;
 };

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-module-deps.git



More information about the Pkg-javascript-commits mailing list