Skip to content

Commit

Permalink
feat: emit deserialize:error event
Browse files Browse the repository at this point in the history
  • Loading branch information
starknt committed May 28, 2023
1 parent d49a66b commit e60918b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/base/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ export class LiveClient<E extends Record<EventKey, any>> extends EventEmitter<Me
this.emit('message', buffer)

const packs = await deserialize(buffer, this.zlib)
.catch((err) => {
if (Error instanceof err)
.catch<Array<Message<any>>>((err) => {
if (err instanceof Error)
// @ts-expect-error emit error
this.emit('deserialize:error', err)

return [] as Array<Message<any>>
return []
})

for (const packet of packs) {
Expand Down

0 comments on commit e60918b

Please sign in to comment.