From 7b850a75653b5e3a1047dae0bcfd7bd0bebac29a 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 PR-URL: https://github.com/nodejs/node/pull/19389 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Matteo Collina --- 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 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); }