Commit bc6e230a by Иван Кубота

Fix ajax response error handling. It was just wrong.

parent f982fc02
......@@ -22,16 +22,18 @@
cb && cb( false, { error: false } );
return;
}else if( xhr.readyState === 4 && xhr.status >= 200 && xhr.status < 300 ){
let json;
let json, error = false;
if( cfg.bonus && cfg.bonus.raw )
return cb && cb( false, xhr );
try{
json = JSON.parse( xhr.responseText );
cb && cb( false, json );
}catch( e ){
error = true;
json = e;
console.error( 'AJAX:' + method + ' Incorrect Response ← ' + cfg.url, xhr.responseText, e );
cb && cb( true, e );
}
cb && cb( error, json );
}else if( xhr.status === 404 ){
cb && cb( true );
}else if( xhr.status === 503 ){
......
{
"name": "react-vanilla",
"version": "1.0.1",
"version": "1.1.11",
"description": "",
"main": "DOM.js",
"scripts": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment