Is there a way to catch failed to load resource: net::ERR_CONNECTION_REFUSED
, I've tried:
try {
$.post('',{},function(res) {
}).fail(function (xhr, textStatus, errorThrown) {
xhr.textStatus = textStatus;
xhr.errorThrown = errorThrown;
console.log('fail',xhr);
// how to get the 'ERR_CONNECTION_REFUSED' or anything else as string?
});
} catch(e) {
console.log('catch',e);
}
The fail function could catch, but I got no information about the error, either it is:
- ERR_NAME_NOT_RESOLVED
- ERR_CONNECTION_REFUSED
- ERR_BLOCKED_BY_CLIENT
- ERR_TUNNEL_CONNECTION_FAILED (when using proxy)
or anything else.. the question would be, how to get the kind of error?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…