From 526b45cd197a8067b7fd96cc8963894aa82badc6 Mon Sep 17 00:00:00 2001 From: akvlad <2798590+akvlad@users.noreply.github.com> Date: Fri, 19 Jan 2024 15:40:29 +0200 Subject: [PATCH] fix: improve error logging (#435) * fix: improve error logging * fix typo --- lib/db/throttler.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/db/throttler.js b/lib/db/throttler.js index 8d84495e..d1da0529 100644 --- a/lib/db/throttler.js +++ b/lib/db/throttler.js @@ -16,7 +16,11 @@ const axiosError = async (err) => { err.response.data.on('data', data => { err.responseData += data }) await new Promise((resolve) => err.response.data.once('end', resolve)) } - return err + if (typeof resp.data === 'string') { + err.responseData = resp.data + } + return new Error('AXIOS ERROR: ' + err + + (err.responseData ? ' Response data: ' + err.responseData : '')) } } catch (e) { return err