From ea7324e22d5a2ab7d3ea6c48f727bb41a4de9ffa Mon Sep 17 00:00:00 2001 From: Matthew Sanders Date: Fri, 18 Nov 2016 10:03:59 -0600 Subject: [PATCH] Handle EPIPE errors along with the current ECONNRESET There is an open issue with Node.js throwing EPIPE errors when you pipe to a closed stream. This was causing me unpredictable errors while loading pages. The errors are pretty similar to ECONNRESET in the sense that you could simply try again and shouldn't throw every time it happens. More info here: https://github.com/nodejs/node/issues/947 --- javascript/node/selenium-webdriver/http/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javascript/node/selenium-webdriver/http/index.js b/javascript/node/selenium-webdriver/http/index.js index fa98557a0f73a..461fef79333ca 100644 --- a/javascript/node/selenium-webdriver/http/index.js +++ b/javascript/node/selenium-webdriver/http/index.js @@ -226,7 +226,7 @@ function sendRequest(options, onOk, onError, opt_data, opt_proxy) { }); request.on('error', function(e) { - if (e.code === 'ECONNRESET') { + if (e.code === 'ECONNRESET' || e.code === 'EPIPE') { setTimeout(function() { sendRequest(options, onOk, onError, opt_data, opt_proxy); }, 15);