Skip to content

Instantly share code, notes, and snippets.

@linus-amg
Created April 23, 2015 02:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save linus-amg/20c663ceda30e7d4d161 to your computer and use it in GitHub Desktop.
Save linus-amg/20c663ceda30e7d4d161 to your computer and use it in GitHub Desktop.
ajaxError
$(document).ajaxError(function(evt, xhr, options) {
var responseText = xhr.responseText || 'The server did not respond on time.';
var status = xhr.status || 408;
var statusText = xhr.statusText || 'Request Timeout';
var message = {
text: responseText,
code: status,
url: xhr.url,
status: statusText
};
var err = new Error(message);
return console.error(err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment