From 57c46e3122f50a83d17e0db9db9598dc063dc0af Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Wed, 28 Oct 2020 22:20:55 +0530 Subject: [PATCH] regen QR call rejectPending --- src/WAConnection/1.Validation.ts | 4 ++-- src/WAConnection/3.Connect.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/WAConnection/1.Validation.ts b/src/WAConnection/1.Validation.ts index 0c6f300..c31cdef 100644 --- a/src/WAConnection/1.Validation.ts +++ b/src/WAConnection/1.Validation.ts @@ -208,7 +208,7 @@ export class WAConnection extends Base { this.qrTimeout = setTimeout (async () => { if (this.state === 'open') return - this.logger.debug ('regenerated QR') + this.logger.debug ('regenerating QR') try { const newRef = await this.generateNewQRCodeRef () ref = newRef @@ -217,7 +217,7 @@ export class WAConnection extends Base { } catch (error) { this.logger.error ({ error }, `error in QR gen`) if (error.status === 429) { // too many QR requests - this.endConnection () + this.rejectPendingConnection (error) } } }, this.connectOptions.regenerateQRIntervalMs) diff --git a/src/WAConnection/3.Connect.ts b/src/WAConnection/3.Connect.ts index 9ae6f84..fca191f 100644 --- a/src/WAConnection/3.Connect.ts +++ b/src/WAConnection/3.Connect.ts @@ -341,7 +341,7 @@ export class WAConnection extends Base { this.logger.debug({ unhandled: true }, messageTag + ',' + JSON.stringify(json)) } } catch (error) { - this.logger.error ({ error }, `encountered error in decrypting message, closing`) + this.logger.error ({ error }, `encountered error in decrypting message, closing: ${error}`) if (this.state === 'open') this.unexpectedDisconnect (DisconnectReason.badSession) else this.rejectPendingConnection (new Error(DisconnectReason.badSession))