diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 2485a145519494..9978df87d6d58d 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -1680,7 +1680,7 @@ class Http2Stream extends Duplex { req.async = false; const err = createWriteReq(req, handle, data, encoding); if (err) - throw errnoException(err, 'write', req.error); + return this.destroy(errnoException(err, 'write', req.error), cb); trackWriteState(this, req.bytes); } @@ -1723,7 +1723,7 @@ class Http2Stream extends Duplex { } const err = handle.writev(req, chunks); if (err) - throw errnoException(err, 'write', req.error); + return this.destroy(errnoException(err, 'write', req.error), cb); trackWriteState(this, req.bytes); }