mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
feat: implement stream:error events
This commit is contained in:
@@ -465,6 +465,12 @@ export const makeSocket = ({
|
|||||||
|
|
||||||
ev.emit('connection.update', { connection: 'open' })
|
ev.emit('connection.update', { connection: 'open' })
|
||||||
})
|
})
|
||||||
|
ws.on('CB:stream:error', (node: BinaryNode) => {
|
||||||
|
logger.error({ error: node }, `stream errored out`)
|
||||||
|
|
||||||
|
const statusCode = +(node.attrs.code || DisconnectReason.restartRequired)
|
||||||
|
end(new Boom('Stream Errored', { statusCode, data: node }))
|
||||||
|
})
|
||||||
// logged out
|
// logged out
|
||||||
ws.on('CB:failure,reason:401', () => {
|
ws.on('CB:failure,reason:401', () => {
|
||||||
end(new Boom('Logged Out', { statusCode: DisconnectReason.loggedOut }))
|
end(new Boom('Logged Out', { statusCode: DisconnectReason.loggedOut }))
|
||||||
|
|||||||
Reference in New Issue
Block a user