fix: better log for ExternalAPI errors

This commit is contained in:
gauthier-th
2024-07-01 00:39:04 +02:00
committed by Gauthier
parent faec3260f6
commit 943d84e4d5

View File

@@ -70,6 +70,12 @@ class ExternalAPI {
...config?.headers,
},
});
if (!response.ok) {
const text = await response.text();
throw new Error(
`${response.status} ${response.statusText}${text ? ': ' + text : ''}`
);
}
const data = await this.getDataFromResponse(response);
if (this.cache) {