diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-07-01 00:34:55 +0200 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-07-05 22:36:53 -0700 |
commit | ba565a37349e81c9d2402b0c8ef05ab39dca8968 (patch) | |
tree | 03f42bdafc7d49e245166faa688a352a0217dd5e /lib/_http_client.js | |
parent | fd23c122631a83ea9b4cf069fb78dfb212ecb742 (diff) | |
download | node-new-ba565a37349e81c9d2402b0c8ef05ab39dca8968.tar.gz |
http: improve parser error messages
Include the library-provided reason in the Error’s `message`.
Fixes: https://github.com/nodejs/node/issues/28468
PR-URL: https://github.com/nodejs/node/pull/28487
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Diffstat (limited to 'lib/_http_client.js')
-rw-r--r-- | lib/_http_client.js | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/_http_client.js b/lib/_http_client.js index 4af23fa8c5..a1750a1a00 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -33,6 +33,7 @@ const { httpSocketSetup, parsers, HTTPParser, + prepareError, } = require('_http_common'); const { OutgoingMessage } = require('_http_outgoing'); const Agent = require('_http_agent'); @@ -451,6 +452,7 @@ function socketOnData(d) { const ret = parser.execute(d); if (ret instanceof Error) { + prepareError(ret, parser, d); debug('parse error', ret); freeParser(parser, req, socket); socket.destroy(); |