@ffflorian/api-client 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/APIClient.js +13 -1
- package/package.json +2 -1
package/dist/APIClient.js
CHANGED
|
@@ -74,7 +74,19 @@ export class APIClient {
|
|
|
74
74
|
url = requestOptions.url;
|
|
75
75
|
const response = await fetch(url, requestOptions);
|
|
76
76
|
if (!response.ok) {
|
|
77
|
-
|
|
77
|
+
let errorText;
|
|
78
|
+
try {
|
|
79
|
+
errorText = await response.text();
|
|
80
|
+
}
|
|
81
|
+
catch (_b) {
|
|
82
|
+
errorText = response.statusText;
|
|
83
|
+
}
|
|
84
|
+
if (errorText) {
|
|
85
|
+
throw new Error(`Request failed with status code ${response.status}: ${errorText}`);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
throw new Error(`Request failed with status code ${response.status}`);
|
|
89
|
+
}
|
|
78
90
|
}
|
|
79
91
|
if (this.interceptors.response.length > 0) {
|
|
80
92
|
for (const interceptor of this.interceptors.response) {
|