From 10e2c4bbd44d43959c1ff737b13af0878b3aba08 Mon Sep 17 00:00:00 2001 From: devlikepro Date: Tue, 15 Oct 2024 18:04:07 +0700 Subject: [PATCH] [core] WEBJS - handle possible stuck STARTING fix #586 --- src/core/engines/webjs/session.webjs.core.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/engines/webjs/session.webjs.core.ts b/src/core/engines/webjs/session.webjs.core.ts index b527f582..239575e2 100644 --- a/src/core/engines/webjs/session.webjs.core.ts +++ b/src/core/engines/webjs/session.webjs.core.ts @@ -230,7 +230,12 @@ export class WhatsappSessionWebJSCore extends WhatsappSession { async start() { this.status = WAHASessionStatus.STARTING; - await this.init(); + await this.init().catch((err) => { + this.logger.error('Failed to start the client'); + this.logger.error(err, err.stack); + this.status = WAHASessionStatus.FAILED; + this.restartClient(); + }); return this; }