From 8defec52798b25bfd3190e4998eea3bf09e5a652 Mon Sep 17 00:00:00 2001 From: xiaojay Date: Fri, 7 Feb 2020 16:27:53 +0800 Subject: [PATCH] fix bug when reject with error --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index dc164ab..90f150b 100644 --- a/index.js +++ b/index.js @@ -161,10 +161,11 @@ module.exports = function () { resolve({statusCode, body, headers}); }); - this.curl.on('error', () => { + this.curl.on('error', (error, errorCode) => { this.curl.close(); this._reset(); - reject(arguments); + const err = {'code':errorCode, 'data':error} + reject(err); }); this.curl.perform(); } catch (e) {