Skip to content

Commit

Permalink
Merge pull request fex-team#1664 from konanzheng/master
Browse files Browse the repository at this point in the history
add http status on error message
  • Loading branch information
2betop authored Nov 28, 2016
2 parents e8d204a + 2af8e9b commit 5ba5c80
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/runtime/flash/transport.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ define([
readBody = true;
} else if ( status >= 500 && status < 600 ) {
readBody = true;
err = 'server';
err = 'server-'+status;
} else {
err = 'http';
err = 'http-'+status;
}

if ( readBody ) {
Expand Down Expand Up @@ -134,9 +134,10 @@ define([
});

xhr.on( 'error', function() {
var status = xhr.exec('getStatus'),err = status?'http-'+status:'http'
xhr.off();
me._xhr = null;
me.trigger( 'error', 'http' );
me.trigger( 'error', err );
});

me._xhr = xhr;
Expand Down
6 changes: 3 additions & 3 deletions src/runtime/html5/transport.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ define([
return me.trigger('load');
} else if ( xhr.status >= 500 && xhr.status < 600 ) {
me._response = xhr.responseText;
return me.trigger( 'error', 'server' );
return me.trigger( 'error', 'server-'+status );
}


return me.trigger( 'error', me._status ? 'http' : 'abort' );
return me.trigger( 'error', me._status ? 'http-'+status : 'abort' );
};

me._xhr = xhr;
Expand All @@ -169,4 +169,4 @@ define([
return json;
}
});
});
});

0 comments on commit 5ba5c80

Please sign in to comment.