Skip to content

Commit

Permalink
fix(browser): uncaught error when stream is destroyed with error
Browse files Browse the repository at this point in the history
Fixes #1839
  • Loading branch information
robertsLando committed Apr 10, 2024
1 parent 9fc79df commit 380f286
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/BufferedDuplex.ts
Expand Up @@ -79,7 +79,8 @@ export class BufferedDuplex extends Duplex {

_destroy(err: Error, callback: (error: Error) => void): void {
this.writeQueue = []
this.proxy.destroy(err)
// do not pass error here otherwise we should listen for `error` event on proxy to prevent uncaught exception
this.proxy.destroy()
callback(err)
}

Expand Down

0 comments on commit 380f286

Please sign in to comment.