projects
/
vchess.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
8c564f4
)
Fix error handling in ajax() function
author
Benjamin Auder
<benjamin.auder@somewhere>
Fri, 29 Nov 2019 23:57:07 +0000
(
00:57
+0100)
committer
Benjamin Auder
<benjamin.auder@somewhere>
Fri, 29 Nov 2019 23:57:07 +0000
(
00:57
+0100)
client/src/utils/ajax.js
patch
|
blob
|
blame
|
history
diff --git
a/client/src/utils/ajax.js
b/client/src/utils/ajax.js
index
5b46078
..
83b045c
100644
(file)
--- 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);
+ }
}
};