From 0d278e19ada669ffe4f0ba25e1049a015389a8a0 Mon Sep 17 00:00:00 2001 From: sugoidogo Date: Sun, 26 Jan 2025 11:47:05 +0000 Subject: [PATCH] throw actuall error objects --- static/TwitchAuth.mjs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/static/TwitchAuth.mjs b/static/TwitchAuth.mjs index a42f839..ce605d7 100644 --- a/static/TwitchAuth.mjs +++ b/static/TwitchAuth.mjs @@ -49,7 +49,7 @@ export function getAppToken(client_id) { headers: { 'content-type': 'application/x-www-form-urlencoded' } }).then(async function (response) { if (!response.ok) { - throw await response.json() + throw new Error(await response.json()) } const token = await response.json() return stamp(token) @@ -105,7 +105,7 @@ export function exchangeCode(client_id, code) { headers: { 'content-type': 'application/x-www-form-urlencoded' } }).then(async function (response) { if (!response.ok) { - throw await response.json() + throw new Error(await response.json()) } const token = await response.json() return stamp(token) @@ -123,7 +123,7 @@ export function validateToken(access_token) { headers: { authorization: 'OAuth ' + access_token } }).then(async response => { if (!response.ok) { - throw await response.json() + throw new Error(await response.json()) } /** @type {TwitchToken} */ const token=await response.json() @@ -154,7 +154,7 @@ export function refreshToken(client_id, refresh_token) { headers: { 'content-type': 'application/x-www-form-urlencoded' } }).then(async function (response) { if (!response.ok) { - throw await response.json() + throw new Error(await response.json()) } return await response.json() })