ASP.net MVC Custom error json result
//=============Custom Error Starts
//private JsonResult ThrowJSONError(Exception e)
//{
// Response.StatusCode = (int)System.Net.HttpStatusCode.BadRequest;
// //e.StackTrace
// // return Json(new { Message = e.Message });
// return Json(new { Error = "Uh oh!" });
//}
//public ActionResult DivideByZero()
//{
// try
// {
// throw new DivideByZeroException();
// }
// catch (DivideByZeroException e)
// {
// return ThrowJSONError(e);
// }
//}
//=============Custom Error Ends
Comments