peer: better error messages.

This commit is contained in:
Christopher Jeffrey 2017-01-15 18:03:22 -08:00
parent fe0ea9ac76
commit afb15787ad
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -1292,6 +1292,13 @@ Peer.prototype.error = function error(err) {
err = new Error(msg);
}
if (typeof err.code === 'string' && err.code[0] === 'E') {
msg = err.code;
err = new Error(msg);
err.code = msg;
err.message = 'Socket Error: ' + msg;
}
err.message += ' (' + this.hostname + ')';
this.emit('error', err);