more logging

This commit is contained in:
Erik 2022-05-11 16:51:49 +03:00
parent 6f74e9af0a
commit a75bce24f7
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB

View File

@ -32,13 +32,14 @@ class BaseClient extends EventEmitter {
async build() { async build() {
const start = Date.now();
await this.shardingManager.spawn().catch((error) => { await this.shardingManager.spawn().catch((error) => {
this.logger.error(`Fatal error during shard spawning:\n${error.stack || error}`); this.logger.error(`Fatal error during shard spawning:\n${error.stack || error}`);
// eslint-disable-next-line no-process-exit // eslint-disable-next-line no-process-exit
process.exit(); // Prevent a boot loop when shards die due to an error in the client process.exit(); // Prevent a boot loop when shards die due to an error in the client
}); });
this.logger.status(`Shards spawned, spawned ${this.shardingManager.shards.size} shards`); this.logger.status(`Shards spawned, spawned ${this.shardingManager.shards.size} shards. Took ${Date.now() - start} ms`);
const API = this._options.api.load ? await import('/Documents/My programs/GBot/api/index.js') const API = this._options.api.load ? await import('/Documents/My programs/GBot/api/index.js')
.catch(() => this.logger.warn(`Error importing API files, continuing without`)) : null; .catch(() => this.logger.warn(`Error importing API files, continuing without`)) : null;