Доброе утро. Что должно произойти, чтобы сработал onerror xhr? Сервер иногда возвращает json данные с кодом 500, и согласно логике в этом случае должно произойти onerror, но происходит onload.
var requestError = function () {
console.log("error", this);
};
var xhr = new XMLHttpRequest();
xhr.open("POST", 'https://core.lotus-app.ru/1/' + method, true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.responseType = "json";
xhr.onload = success;
xhr.onerror = requestError;
xhr.timeout = timeout;
xhr.vars = vars;
xhr.send(paramToURL(params));
Status Code:200OK
с json, а 500. На сервере, например php будет это выглядеть как-то такheader('HTTP/1.1 500 Internal Server Error');