mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
minor connect change
This commit is contained in:
@@ -203,9 +203,9 @@ export class WAConnection extends Base {
|
|||||||
.then (newRef => ref = newRef)
|
.then (newRef => ref = newRef)
|
||||||
.then (emitQR)
|
.then (emitQR)
|
||||||
.then (regenQR)
|
.then (regenQR)
|
||||||
.catch (err => {
|
.catch (error => {
|
||||||
this.logger.error (`error in QR gen: `, err)
|
this.logger.error ({ error }, `error in QR gen`)
|
||||||
if (err.status === 429) { // too many QR requests
|
if (error.status === 429) { // too many QR requests
|
||||||
this.endConnection ()
|
this.endConnection ()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export class WAConnection extends Base {
|
|||||||
lastConnect = new Date()
|
lastConnect = new Date()
|
||||||
|
|
||||||
const loggedOut = error instanceof BaileysError && UNAUTHORIZED_CODES.includes(error.status)
|
const loggedOut = error instanceof BaileysError && UNAUTHORIZED_CODES.includes(error.status)
|
||||||
const willReconnect = !loggedOut && (tries <= (options?.maxRetries || 5)) && this.state === 'connecting'
|
const willReconnect = !loggedOut && (tries < options?.maxRetries) && (this.state === 'connecting')
|
||||||
const reason = loggedOut ? DisconnectReason.invalidSession : error.message
|
const reason = loggedOut ? DisconnectReason.invalidSession : error.message
|
||||||
|
|
||||||
this.logger.warn ({ error }, `connect attempt ${tries} failed${ willReconnect ? ', retrying...' : ''}`)
|
this.logger.warn ({ error }, `connect attempt ${tries} failed${ willReconnect ? ', retrying...' : ''}`)
|
||||||
|
|||||||
Reference in New Issue
Block a user