From 0c417db180a1381428ba2c32737df74f28e2185e Mon Sep 17 00:00:00 2001 From: Sebastian Gerske <13647606+H34D@users.noreply.github.com> Date: Tue, 22 Nov 2022 12:21:25 +0100 Subject: [PATCH] updated logging --- src/common/helpers/rest-calls/index.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/common/helpers/rest-calls/index.ts b/src/common/helpers/rest-calls/index.ts index 4353ca98..8ade7bc8 100644 --- a/src/common/helpers/rest-calls/index.ts +++ b/src/common/helpers/rest-calls/index.ts @@ -105,10 +105,11 @@ export const useMasaQuery = ( const { token } = useAccessToken(); + const url = `${URL(apiURL)}${fullPath}`; const query = useQuery( name, () => - fetch(`${URL(apiURL)}${fullPath}`, { + fetch(url, { headers: { ...headers, Authorization: token ? `Bearer ${token}` : undefined, @@ -124,11 +125,14 @@ export const useMasaQuery = ( console.log('NOT OK'); } if (res.status > 399) { - throw new Error('ERR'); + throw new Error( + `Received Error Code during fetch: ${res.status} at ${url}` + ); } return res.json(); }) .catch((err) => { + console.error('Query failed!:', err.message, url); throw new Error(err); }), {