I have a grid on an MVC page, I have an error event as follows:
.DataSource(dataSource => dataSource
.Ajax()
.Batch(false)
.PageSize(50)
.Events(events => events.Error("gridErrorHandler"))
My JavaScript function is something like:
function gridErrorHandler(e) {
...
}
I have an MVC method (that returns ActionResult) that throws the following error when an error condition occurs:
return new HttpStatusCodeResult(System.Net.HttpStatusCode.InternalServerError, "Unexpected error");
My question is this. When my MVC method throws an exception, my JS error handler gets called. But, no matter what I try, I'm not able to get at the type of error it is. What exactly is the correct JS code that tells me a 500 error occurred, or a 401 (unauthorized) error occurred, etc.?