Skip to content

Commit

Permalink
added name and code to timeout error
Browse files Browse the repository at this point in the history
  • Loading branch information
Trevor Livingston committed Nov 3, 2015
1 parent b5fcdda commit 37cdbc1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/breaker.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,14 @@ Breaker.prototype._run = function _run(/*args...n, callback*/) {
start = Date.now();

timer = setTimeout(function ontimeout() {

var error = new Error('Command timeout.');
error.name = 'commandTimeout';
error.code = 'ETIMEDOUT';
timer = undefined;
self._pendingClose = false;
self.emit('timeout');
self._onFailure();
callback(new Error('Command timeout.'));

callback(error);
}, this.settings.timeout);

timer.unref();
Expand Down

0 comments on commit 37cdbc1

Please sign in to comment.