From 33e1408f0cbe3229cfe61aebaf3edf7fa9800cb8 Mon Sep 17 00:00:00 2001 From: Robert Brennan Date: Mon, 12 Feb 2024 11:28:30 -0500 Subject: [PATCH] Update lib/parser.js --- lib/parser.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/parser.js b/lib/parser.js index d655ddc..6aaccb0 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -118,7 +118,9 @@ class Parser { }) req.on('error', reject); timeout = setTimeout(() => { - req.destroy(new Error("Request timed out after " + this.options.timeout + "ms")); + let err = new Error("Request timed out after " + this.options.timeout + "ms"); + req.destroy(err); + reject(err); }, this.options.timeout); }).then(data => { clearTimeout(timeout);