This commit is contained in:
Erik 2022-07-23 21:07:00 +03:00
parent 5f646f3321
commit 0a0a5f1385
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB

View File

@ -1,8 +1,9 @@
/* Adopted from Discord.js v13 */
const { EventEmitter } = require('events');
const { Util } = require('discord.js');
const { makePlainError, makeError } = require('discord.js');
const path = require('path');
const { Util } = require('../../utilities');
let childProcess = null;
let Worker = null;
@ -179,7 +180,7 @@ class Shard extends EventEmitter {
child.removeListener('message', listener);
this._evals.delete(_eval);
if (!message._error) resolve(message._result);
else reject(Util.makeError(message._error));
else reject(makeError(message._error));
};
child.on('message', listener);
@ -218,7 +219,7 @@ class Shard extends EventEmitter {
const resp = { _sFetchProp: message._sFetchProp, _sFetchPropShard: message._sFetchPropShard };
this.manager.fetchClientValues(message._sFetchProp, message._sFetchPropShard).then(
(results) => this.send({ ...resp, _result: results }),
(error) => this.send({ ...resp, _error: Util.makePlainError(error) })
(error) => this.send({ ...resp, _error: makePlainError(error) })
);
return;
}
@ -227,7 +228,7 @@ class Shard extends EventEmitter {
const resp = { _sEval: message._sEval, _sEvalShard: message._sEvalShard };
this.manager._performOnShards('eval', [message._sEval], message._sEvalShard).then(
(results) => this.send({ ...resp, _result: results }),
(error) => this.send({ ...resp, _error: Util.makePlainError(error) })
(error) => this.send({ ...resp, _error: makePlainError(error) })
);
return;
}