[Pkg-javascript-commits] [node-stream-http] 166/208: Catching fetch `read()` errors
Bastien Roucariès
rouca at moszumanska.debian.org
Sun Aug 13 13:39:40 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-stream-http.
commit f97dd885eae71c4433044e3dae956776a51384f1
Author: Roman Lisagor <rlisagor at gmail.com>
Date: Wed Jan 4 12:42:29 2017 -0800
Catching fetch `read()` errors
Errors that occur while reading from the ReadableStream that is returned as part of a `fetch` request were not handled. This change propagates these errors up to the `ClientRequest`.
---
lib/request.js | 4 ++++
lib/response.js | 2 ++
2 files changed, 6 insertions(+)
diff --git a/lib/request.js b/lib/request.js
index 97e4815..b3f44f7 100644
--- a/lib/request.js
+++ b/lib/request.js
@@ -228,6 +228,10 @@ ClientRequest.prototype._connect = function () {
return
self._response = new IncomingMessage(self._xhr, self._fetchResponse, self._mode)
+ self._response.on('error', function(err) {
+ self.emit('error', err)
+ })
+
self.emit('response', self._response)
}
diff --git a/lib/response.js b/lib/response.js
index b900e76..e5d057d 100644
--- a/lib/response.js
+++ b/lib/response.js
@@ -53,6 +53,8 @@ var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode) {
}
self.push(new Buffer(result.value))
read()
+ }).catch(function(err) {
+ self.emit('error', err)
})
}
read()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-stream-http.git
More information about the Pkg-javascript-commits
mailing list