From 312423e2a4c3b1ed19bb1506dc53f621e671b705 Mon Sep 17 00:00:00 2001 From: RemixDev Date: Sat, 3 Jul 2021 13:03:56 +0200 Subject: [PATCH] Added retry for deezer availability check and log error's traceback --- server/dist/main.js | 6 ++++-- server/src/main.ts | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/server/dist/main.js b/server/dist/main.js index 69837e7..777410f 100644 --- a/server/dist/main.js +++ b/server/dist/main.js @@ -38,10 +38,12 @@ function isDeezerAvailable() { let response; try { response = yield got_1.default.get('https://www.deezer.com/', { - headers: { Cookie: 'dz_lang=en; Domain=deezer.com; Path=/; Secure; hostOnly=false;' } + headers: { Cookie: 'dz_lang=en; Domain=deezer.com; Path=/; Secure; hostOnly=false;' }, + retry: 5 }); } - catch (_a) { + catch (e) { + console.trace(e); deezerAvailable = false; return deezerAvailable; } diff --git a/server/src/main.ts b/server/src/main.ts index d9750e2..3ef54d3 100644 --- a/server/src/main.ts +++ b/server/src/main.ts @@ -27,9 +27,11 @@ export async function isDeezerAvailable(): Promise { let response try { response = await got.get('https://www.deezer.com/', { - headers: { Cookie: 'dz_lang=en; Domain=deezer.com; Path=/; Secure; hostOnly=false;' } + headers: { Cookie: 'dz_lang=en; Domain=deezer.com; Path=/; Secure; hostOnly=false;' }, + retry: 5 }) - } catch { + } catch (e) { + console.trace(e) deezerAvailable = false return deezerAvailable }