mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
chore: handle irrecoverable error
This commit is contained in:
@@ -393,7 +393,9 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
|||||||
} catch(error) {
|
} catch(error) {
|
||||||
// if retry attempts overshoot
|
// if retry attempts overshoot
|
||||||
// or key not found
|
// or key not found
|
||||||
const isIrrecoverableError = attemptsMap[name]! >= MAX_SYNC_ATTEMPTS || error.output?.statusCode === 404
|
const isIrrecoverableError = attemptsMap[name]! >= MAX_SYNC_ATTEMPTS
|
||||||
|
|| error.output?.statusCode === 404
|
||||||
|
|| error.message.includes('TypeError')
|
||||||
logger.info({ name, error: error.stack }, `failed to sync state from version${isIrrecoverableError ? '' : ', removing and trying from scratch'}`)
|
logger.info({ name, error: error.stack }, `failed to sync state from version${isIrrecoverableError ? '' : ', removing and trying from scratch'}`)
|
||||||
await authState.keys.set({ 'app-state-sync-version': { [name]: null } })
|
await authState.keys.set({ 'app-state-sync-version': { [name]: null } })
|
||||||
// increment number of retries
|
// increment number of retries
|
||||||
|
|||||||
Reference in New Issue
Block a user