Permalink
Browse files

return an error object for better errors

  • Loading branch information...
1 parent 3d543a5 commit ae5045cce4980a87b7151cfe91bc5889951aae39 @substack committed Oct 2, 2012
Showing with 5 additions and 1 deletion.
  1. +4 −0 example/dup.js
  2. +1 −1 index.js
View
4 example/dup.js
@@ -0,0 +1,4 @@
+var run = require('commandante');
+
+var node = run('node');
+process.stdin.pipe(node).pipe(process.stdout);
View
2 index.js
@@ -13,7 +13,7 @@ module.exports = function (cmd, args) {
ps.on('exit', function (code) {
if (code === 0) return;
- dup.emit('error', 'non-zero exit code ' + code + ': ' + err);
+ dup.emit('error', new Error('non-zero exit code ' + code + ': ' + err));
});
var dup = duplexer(ps.stdin, ps.stdout);

0 comments on commit ae5045c

Please sign in to comment.