Add optional error arg to client destroy event
This commit is contained in:
parent
4bd454e608
commit
aed6d2b043
|
@ -700,9 +700,11 @@ Client.prototype.unbind = function unbind(callback) {
|
|||
* possible to initiate new requests after a call to unbind since the client
|
||||
* will attempt to reconnect in order to fulfill the request.
|
||||
*
|
||||
* Calling destroy will prevent any further reconnections from occuring.
|
||||
* Calling destroy will prevent any further reconnection from occurring.
|
||||
*
|
||||
* @param {Object} err (Optional) error that was cause of client destruction
|
||||
*/
|
||||
Client.prototype.destroy = function destroy() {
|
||||
Client.prototype.destroy = function destroy(err) {
|
||||
this.destroyed = true;
|
||||
this.queue.freeze();
|
||||
// Purge any queued requests which are now meaningless
|
||||
|
@ -716,7 +718,7 @@ Client.prototype.destroy = function destroy() {
|
|||
} else if (this.socket) {
|
||||
this.socket.destroy();
|
||||
}
|
||||
this.emit('destroy');
|
||||
this.emit('destroy', err);
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue