diff --git a/src/Former/FormerResolveSpecAPI.ts b/src/Former/FormerResolveSpecAPI.ts index d55ed6d..ee1521b 100644 --- a/src/Former/FormerResolveSpecAPI.ts +++ b/src/Former/FormerResolveSpecAPI.ts @@ -62,6 +62,10 @@ function FormerResolveSpecAPI(options: { const response = await fetch(url, fetchOptions); if (!response.ok) { + const text = await response.text(); + if (text && text.length > 4) { + throw new Error(`${text}`); + } throw new Error(`API request failed with status ${response.status}`); } diff --git a/src/Former/FormerRestHeadSpecAPI.ts b/src/Former/FormerRestHeadSpecAPI.ts index 7c4aeef..39b81ac 100644 --- a/src/Former/FormerRestHeadSpecAPI.ts +++ b/src/Former/FormerRestHeadSpecAPI.ts @@ -35,6 +35,10 @@ function FormerRestHeadSpecAPI(options: { const response = await fetch(url, fetchOptions); if (!response.ok) { + const text = await response.text(); + if (text && text.length > 4) { + throw new Error(`${text}`); + } throw new Error(`API request failed with status ${response.status}`); }