fix(ShardClientUtil): send method erroneously rejecting (#2604)

This commit is contained in:
RumbleFrog
2018-06-17 02:21:51 -04:00
committed by SpaceEEC
parent d97af9d2e0
commit c5fea45f30

View File

@@ -1,6 +1,5 @@
const Util = require('../util/Util'); const Util = require('../util/Util');
const { Events } = require('../util/Constants'); const { Events } = require('../util/Constants');
const { Error } = require('../errors');
/** /**
* Helper class for sharded clients spawned as a child process, such as from a {@link ShardingManager}. * Helper class for sharded clients spawned as a child process, such as from a {@link ShardingManager}.
@@ -43,10 +42,9 @@ class ShardClientUtil {
*/ */
send(message) { send(message) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const sent = process.send(message, err => { process.send(message, err => {
if (err) reject(err); else resolve(); if (err) reject(err); else resolve();
}); });
if (!sent) throw new Error('SHARDING_PARENT_CONNECTION');
}); });
} }