diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 2a4ef0421f7c84..967e8abca37efb 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -1677,7 +1677,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); } @@ -1720,7 +1720,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); }