From 37e7e40ddf47ef006320eacf4e4899ba09ea5064 Mon Sep 17 00:00:00 2001 From: sugoidogo Date: Sun, 2 Feb 2025 18:08:32 +0000 Subject: [PATCH] throw text error messages --- static/TwitchAuth.mjs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/static/TwitchAuth.mjs b/static/TwitchAuth.mjs index 85174c9..1345170 100644 --- a/static/TwitchAuth.mjs +++ b/static/TwitchAuth.mjs @@ -52,7 +52,7 @@ export function getAppToken(client_id) { headers: { 'content-type': 'application/x-www-form-urlencoded' } }).then(async function (response) { if (!response.ok) { - throw new Error(await response.json()) + throw new Error(await response.text()) } const token = await response.json() return stamp(token) @@ -109,7 +109,7 @@ export function exchangeCode(client_id, code) { headers: { 'content-type': 'application/x-www-form-urlencoded' } }).then(async function (response) { if (!response.ok) { - throw new Error(await response.json()) + throw new Error(await response.text()) } const token = await response.json() return stamp(token) @@ -127,7 +127,7 @@ export function validateToken(access_token) { headers: { authorization: 'OAuth ' + access_token } }).then(async response => { if (!response.ok) { - throw new Error(await response.json()) + throw new Error(await response.text()) } /** @type {TwitchToken} */ const token = await response.json() @@ -158,7 +158,7 @@ export function refreshToken(client_id, refresh_token) { headers: { 'content-type': 'application/x-www-form-urlencoded' } }).then(async function (response) { if (!response.ok) { - throw new Error(await response.json()) + throw new Error(await response.text()) } return await response.json() })