add handling to some places in javascript that can potentially cause issues #6898

This commit is contained in:
AUTOMATIC
2023-01-19 15:58:32 +03:00
parent 79d802b48a
commit c12d7ddd72
2 changed files with 13 additions and 6 deletions

View File

@@ -81,8 +81,13 @@ function request(url, data, handler, errorHandler){
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
var js = JSON.parse(xhr.responseText);
handler(js)
try {
var js = JSON.parse(xhr.responseText);
handler(js)
} catch (error) {
console.error(error);
errorHandler()
}
} else{
errorHandler()
}