From 6f57a9769ad80459d086abf5232d01ec1ce7a470 Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Sat, 30 Nov 2019 00:57:07 +0100 Subject: [PATCH] Fix error handling in ajax() function --- client/src/utils/ajax.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/client/src/utils/ajax.js b/client/src/utils/ajax.js index 5b460784..83b045c0 100644 --- a/client/src/utils/ajax.js +++ b/client/src/utils/ajax.js @@ -37,10 +37,15 @@ export function ajax(url, method, data, success, error) // Plain text (e.g. for rules retrieval) return success(xhr.responseText); } - if (!res_json.errmsg) + if (!res_json.errmsg && !res_json.errno) success(res_json); else - error(res_json.errmsg); + { + if (!!res_json.errmsg) + error(res_json.errmsg); + else + error(res_json.code + ". errno = " + res_json.errno); + } } }; -- 2.44.0