[Pkg-javascript-commits] [node-module-deps] 62/444: emit errors for transform lookups correctly

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 14902bd26407d07a108ec5822fdc85f2c571f57b
Author: James Halliday <mail at substack.net>
Date:   Sun Mar 31 11:29:41 2013 -0700

    emit errors for transform lookups correctly
---
 index.js | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/index.js b/index.js
index eb693e9..5510029 100644
--- a/index.js
+++ b/index.js
@@ -81,7 +81,9 @@ module.exports = function (mains, opts) {
         
         (function ap (trs) {
             if (trs.length === 0) return done();
-            makeTransform(file, trs[0], function (s) {
+            makeTransform(file, trs[0], function (err, s) {
+                if (err) return output.emit('error', err);
+                
                 s.on('error', output.emit.bind(output, 'error'));
                 s.pipe(concatStream(function (err, data) {
                     src = data;
@@ -135,13 +137,14 @@ module.exports = function (mains, opts) {
         
         var params = { basedir: path.dirname(file) };
         nodeResolve(tr, params, function (err, res) {
-            if (err) return cb(through());
+            if (err) return cb(err)
             
-            if (!res) return output.emit('error', new Error([
+            if (!res) return cb(new Error([
                 'cannot find transform module ', tr,
                 ' while transforming ', file
             ].join('')));
-            cb(require(res)(file));
+            
+            cb(null, require(res)(file));
         });
     }
 };

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