From a0de75f29087cd14424670a617e5aaefc6b25a1e Mon Sep 17 00:00:00 2001 From: Schuyler Cebulskie Date: Wed, 7 Dec 2016 00:30:32 -0500 Subject: [PATCH] Improve ShardClientUtil warnings/errors --- src/sharding/ShardClientUtil.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/sharding/ShardClientUtil.js b/src/sharding/ShardClientUtil.js index 295b5fbcd..6449941f5 100644 --- a/src/sharding/ShardClientUtil.js +++ b/src/sharding/ShardClientUtil.js @@ -119,9 +119,10 @@ class ShardClientUtil { * @private */ _respond(type, message) { - this.send(message).catch(err => - this.client.emit('error', `Error when sending ${type} response to master process: ${err}`) - ); + this.send(message).catch(err => { + err.message = `Error when sending ${type} response to master process: ${err.message}`; + this.client.emit('error', err); + }); } /** @@ -133,7 +134,7 @@ class ShardClientUtil { if (!this._singleton) { this._singleton = new this(client); } else { - client.emit('error', 'Multiple clients created in child process; only the first will handle sharding helpers.'); + client.emit('warn', 'Multiple clients created in child process; only the first will handle sharding helpers.'); } return this._singleton; }