From 288219650ba9fecad9065f1aed86b2511ca9900f Mon Sep 17 00:00:00 2001 From: Sarat Addepalli Date: Fri, 16 Mar 2018 17:29:47 +0530 Subject: [PATCH] http2: destroy() stream, upon errnoException First steps towards #19060 --- lib/internal/http2/core.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); }