regen QR call rejectPending

This commit is contained in:
Adhiraj Singh
2020-10-28 22:20:55 +05:30
parent 0a56406da3
commit 57c46e3122
2 changed files with 3 additions and 3 deletions

View File

@@ -208,7 +208,7 @@ export class WAConnection extends Base {
this.qrTimeout = setTimeout (async () => { this.qrTimeout = setTimeout (async () => {
if (this.state === 'open') return if (this.state === 'open') return
this.logger.debug ('regenerated QR') this.logger.debug ('regenerating QR')
try { try {
const newRef = await this.generateNewQRCodeRef () const newRef = await this.generateNewQRCodeRef ()
ref = newRef ref = newRef
@@ -217,7 +217,7 @@ export class WAConnection extends Base {
} catch (error) { } catch (error) {
this.logger.error ({ error }, `error in QR gen`) this.logger.error ({ error }, `error in QR gen`)
if (error.status === 429) { // too many QR requests if (error.status === 429) { // too many QR requests
this.endConnection () this.rejectPendingConnection (error)
} }
} }
}, this.connectOptions.regenerateQRIntervalMs) }, this.connectOptions.regenerateQRIntervalMs)

View File

@@ -341,7 +341,7 @@ export class WAConnection extends Base {
this.logger.debug({ unhandled: true }, messageTag + ',' + JSON.stringify(json)) this.logger.debug({ unhandled: true }, messageTag + ',' + JSON.stringify(json))
} }
} catch (error) { } 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) if (this.state === 'open') this.unexpectedDisconnect (DisconnectReason.badSession)
else this.rejectPendingConnection (new Error(DisconnectReason.badSession)) else this.rejectPendingConnection (new Error(DisconnectReason.badSession))