Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #2 from drey101/master
Browse files Browse the repository at this point in the history
Default message for error encountered while establishing error is mod…
  • Loading branch information
maktouch authored Mar 15, 2018
2 parents 858c028 + df201e9 commit e44dc3e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ FiveBeansWorker.prototype.start = function(tubes)

this.client.on('error', function(err)
{
if(!err.metadata){
err.metadata = {};
}

err.metadata.fivebeans_error = 'beanstalkd connection error';

self.emitWarning({message: 'beanstalkd connection error', error: err});
self.emit('error', err);
});
Expand Down Expand Up @@ -149,7 +155,8 @@ FiveBeansWorker.prototype.doNext = function()
}
else
{
self.emit('job.reserved', jobID);
try{ self.emit('job.reserved', jobID, payload.toString()); }
catch(e){ self.emit('job.reserved', jobID, 'unable to convert payload to string.'); }

var job = null;
try { job = JSON.parse(payload.toString()); }
Expand Down

0 comments on commit e44dc3e

Please sign in to comment.