Skip to content

Instantly share code, notes, and snippets.

@GeoffCox
Created December 18, 2014 17:50
Show Gist options
  • Save GeoffCox/b3778ace858f93e063e2 to your computer and use it in GitHub Desktop.
Save GeoffCox/b3778ace858f93e063e2 to your computer and use it in GitHub Desktop.
Extract ajax error message from MVC exception
private _getErrorMessage(jqXHR: JQueryXHR, textStatus, errorThrown): string {
var message = textStatus + ' ' + errorThrown;
var error = <any>$.parseJSON(jqXHR.responseText);
if (error) {
message = error.Message;
if (error.ExceptionMessage) {
message += error.ExceptionMessage;
}
}
return message;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment