Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't let JSON errors crash client

  • Loading branch information...
commit 3150ed0ddf52b1ddb251386952b53ae560301208 1 parent f46a239
@tim-smart tim-smart authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 index.js
View
8 index.js
@@ -125,10 +125,12 @@ var Worker = function (options) {
return self.emit('error', error);
}
- var data = JSON.parse(Buffer.isBuffer(data[1]) ? data[1].toString() : data),
- job = new Job(self, data);
+ try {
+ data = JSON.parse(Buffer.isBuffer(data[1]) ? data[1].toString() : data[1]);
+ var job = new Job(self, data);
- self.emit('message', job);
+ self.emit('message', job);
+ } catch (json_error) {}
if (!self.client.quitting && self.continual) {
// Listen for more jobs.
Please sign in to comment.
Something went wrong with that request. Please try again.