worker-farm
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -18,9 +18,12 @@ var $module | ||
if (_args[0] instanceof Error) { | ||
var e = _args[0] | ||
_args[0] = { | ||
'$error' : '$error' | ||
, 'type' : _args[0].constructor.name | ||
, 'message' : _args[0].message | ||
, 'stack' : _args[0].stack | ||
, 'data' : _args[0].data | ||
, 'type' : e.constructor.name | ||
, 'message' : e.message | ||
, 'stack' : e.stack | ||
} | ||
Object.keys(e).forEach(function(key) { | ||
_args[0][key] = e[key] | ||
}) | ||
} | ||
@@ -46,2 +49,2 @@ process.send({ idx: idx, child: child, args: _args }) | ||
handle(data) | ||
}) | ||
}) |
{ | ||
"name": "worker-farm", | ||
"description": "Distribute processing tasks to child processes with an über-simple API and baked-in durability & custom concurrency options.", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"homepage": "https://github.com/rvagg/node-worker-farm", | ||
@@ -6,0 +6,0 @@ "authors": [ |
@@ -26,3 +26,5 @@ var fs = require('fs') | ||
var err = new Error(message) | ||
err.data = data | ||
Object.keys(data).forEach(function(key) { | ||
err[key] = data[key] | ||
}) | ||
callback(err) | ||
@@ -29,0 +31,0 @@ return |
@@ -362,3 +362,3 @@ var tape = require('tape') | ||
tape('test error passing', function (t) { | ||
t.plan(9) | ||
t.plan(10) | ||
@@ -376,5 +376,6 @@ var child = workerFarm(childPath, [ 'err' ]) | ||
}) | ||
child.err('Error', 'this is an Error with data', {foo: 'bar'}, function (err) { | ||
child.err('Error', 'this is an Error with custom props', {foo: 'bar', 'baz': 1}, function (err) { | ||
t.ok(err instanceof Error, 'is an Error object') | ||
t.deepEqual(err.data, {foo: 'bar'}, 'passes data') | ||
t.equal(err.foo, 'bar', 'passes data') | ||
t.equal(err.baz, 1, 'passes data') | ||
}) | ||
@@ -381,0 +382,0 @@ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
42383
866
2