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 payload = null;
var text = ''; var text = await response.text();
try { if (text) {
payload = await response.json(); try {
} catch (_error) { payload = JSON.parse(text);
text = await response.text(); } catch (_error) {}
} }
if (!response.ok) { if (!response.ok) {