better-queue
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -66,10 +66,14 @@ | ||
} | ||
self._process = self.fn.call(self, tasks, function (err, result) { | ||
if (!self.active) return; | ||
if (err) { | ||
self.failedBatch(err.message || err); | ||
} else { | ||
self.finishBatch(result); | ||
} | ||
}); | ||
try { | ||
self._process = self.fn.call(self, tasks, function (err, result) { | ||
if (!self.active) return; | ||
if (err) { | ||
self.failedBatch(err.message || err); | ||
} else { | ||
self.finishBatch(result); | ||
} | ||
}) | ||
} catch (err) { | ||
self.failedBatch(err.message || err); | ||
} | ||
self._process = self._process || {}; | ||
@@ -76,0 +80,0 @@ } |
{ | ||
"name": "better-queue", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Better Queue for NodeJS", | ||
@@ -5,0 +5,0 @@ "main": "lib/queue.js", |
@@ -19,2 +19,13 @@ var assert = require('assert'); | ||
it('should catch thrown errors', function (done) { | ||
var q = new Queue(function (n, cb) { | ||
throw new Error("failed"); | ||
}) | ||
q.on('task_failed', function (taskId, msg) { | ||
assert.equal(msg, "failed"); | ||
done(); | ||
}) | ||
q.push(1) | ||
}); | ||
it('should fail', function (done) { | ||
@@ -21,0 +32,0 @@ var q = new Queue(function (n, cb) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63055
1597