[Pkg-javascript-commits] [node-module-deps] 59/444: Catch and handle parsing errors from detective, add filename in error message.

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 15 09:47:43 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 ecd6479134af4f679087ecfe2dcf1da135200bf9
Author: Jeremy Judeaux <jeremy.judeaux at gmail.com>
Date:   Thu Mar 21 15:42:20 2013 +0100

    Catch and handle parsing errors from detective, add filename in error message.
---
 index.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/index.js b/index.js
index f4dcf63..eb693e9 100644
--- a/index.js
+++ b/index.js
@@ -97,7 +97,13 @@ module.exports = function (mains, opts) {
     }
     
     function parseDeps (file, src) {
-        var deps = detective(src);
+        var deps;
+        try {
+            deps = detective(src);
+        } catch (ex) {
+            var message = ex && ex.message ? ex.message : ex;
+            return output.emit('error', new Error('Parsing file ' + file + ': ' + message));
+        }
         var p = deps.length;
         var current = { id: file, filename: file, paths: [] };
         var resolved = {};

-- 
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