fix: handle non-json api error responses

This commit is contained in:
a.tolmachev
2026-03-31 01:04:10 +03:00
parent fd30e8f626
commit a893ed01f5
+5 -5
View File
@@ -19,12 +19,12 @@
}
var payload = null;
var text = '';
var text = await response.text();
try {
payload = await response.json();
} catch (_error) {
text = await response.text();
if (text) {
try {
payload = JSON.parse(text);
} catch (_error) {}
}
if (!response.ok) {