From 38ccc730acaeb19af0f3ef4c6675bf44181a3eaa Mon Sep 17 00:00:00 2001 From: kevcenteno Date: Mon, 2 Dec 2024 17:04:45 -0500 Subject: [PATCH] Minor cleanup --- src/webServiceClient.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/webServiceClient.ts b/src/webServiceClient.ts index 810717bd..ea1216aa 100644 --- a/src/webServiceClient.ts +++ b/src/webServiceClient.ts @@ -106,29 +106,29 @@ export default class WebServiceClient { } if (response.status === 204) { - return Promise.resolve(); + return; } data = await response.json(); } catch (err) { const error = err as TypeError; switch (error.name) { case 'AbortError': - return Promise.reject({ + throw { code: 'NETWORK_TIMEOUT', error: 'The request timed out', url, - }); + }; case 'SyntaxError': - return Promise.reject({ + throw { ...invalidResponseBody, url, - }); + }; default: - return Promise.reject({ + throw { code: 'FETCH_ERROR', error: `${error.name} - ${error.message}`, url, - }); + }; } } finally { clearTimeout(timeoutId);