[core] session FAILED if apps not started

This commit is contained in:
devlikepro committed 2025-12-05 00:15:49 -08:00
1 parent f5d216df6f
commit 01c9c2ca56
2 files changed
+13 -4

No files matched your search

+1 -1
View File
@@ -321,7 +321,7 @@ export abstract class WhatsappSession {
return this.events2.get(event);
}
protected set status(value: WAHASessionStatus) {
public set status(value: WAHASessionStatus) {
if (this.unpairing && value !== WAHASessionStatus.STOPPED) {
// In case of unpairing
// wait for STOPPED event, ignore the rest
+12 -3
View File
@@ -218,11 +218,20 @@ export class SessionManagerCore extends SessionManager implements OnModuleInit {
webhook.configure(session, webhooks);
// Apps
await this.appsService.beforeSessionStart(session, this.store);
try {
await this.appsService.beforeSessionStart(session, this.store);
} catch (e) {
logger.error(`Apps Error: ${e}`);
session.status = WAHASessionStatus.FAILED;
}
// start session
await session.start();
logger.info('Session has been started.');
if (session.status !== WAHASessionStatus.FAILED) {
await session.start();
logger.info('Session has been started.');
// Apps
await this.appsService.afterSessionStart(session, this.store);
}
// Apps
await this.appsService.afterSessionStart(session, this.store);