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