From 84cc45d9af431df697e2b6a6fbaaa08dfd005e42 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Fri, 19 Jul 2019 16:08:26 +0200 Subject: [PATCH] Unify result --- lib/utils/tracking.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/utils/tracking.js b/lib/utils/tracking.js index 60623165c..55ea23ee8 100644 --- a/lib/utils/tracking.js +++ b/lib/utils/tracking.js @@ -33,9 +33,12 @@ const logError = (type, error) => { }; const processResponseBody = (response, id) => { - return response.buffer().catch(error => { - logError(`Response processing error for ${id}`, error); - }); + return response.buffer().then( + () => {}, // For consistency do not expose any result + error => { + logError(`Response processing error for ${id}`, error); + } + ); }; /* note tracking swallows errors */ @@ -62,7 +65,9 @@ function request(type, event, { id, timeout } = {}) { }); }); }, - networkError => logError('Request network error', networkError) + networkError => { + logError('Request network error', networkError); + } ); } @@ -93,7 +98,7 @@ function track(type, event, options = {}) { }); }), request(type, event, { id }), - ]); + ]).then(([, requestResult]) => requestResult); // In all cases resolve with request result }); }