Node.js based forum software built for the modern web
refactor: fallback error string
Barış Soner Uşaklı7bd73114778d
diff --git a/public/src/modules/api.js b/public/src/modules/api.jsindex 4443f38c38..2d60c6b791 100644--- a/public/src/modules/api.js+++ b/public/src/modules/api.js@@ -87,9 +87,10 @@ async function xhr(options) {if (!res.ok) {if (response) {const jsonError = isJSON && (response.status?.message || response.error || '');+ const fallbackError = typeof response === 'string' ? response : (res.statusText || `[[error:api.${res.status}]]`);throw new Error(isJSON && jsonError ?jsonError :- typeof response === 'string' ? response : res.statusText+ fallbackError);}throw new Error(res.statusText);