/// <summary> /// Ensure that exceptions are returned in the API format /// Excpetion is rendered as a Callback Exception /// </summary> /// <param name="filterContext"></param> protected override void OnException(ExceptionContext filterContext) { base.OnException(filterContext); // only handle API results here: Format must be set // otherwise fall through and return if (string.IsNullOrEmpty(this.Format)) { return; } Response.StatusCode = 500; Westwind.Web.CallbackException exception = new Westwind.Web.CallbackException(); exception.message = filterContext.Exception.Message; if (HttpContext.IsDebuggingEnabled) { exception.stackTrace = filterContext.Exception.StackTrace; } exception.isCallbackError = true; filterContext.Result = this.ApiResult(exception); filterContext.ExceptionHandled = true; }
protected ActionResult ExceptionResult(string message) { Response.StatusCode = 500; Westwind.Web.CallbackException exception = new Westwind.Web.CallbackException(); exception.message = message; exception.isCallbackError = true; // return result based on ?Format= return(this.ApiResult(exception)); }
protected ActionResult ExceptionResult(Exception ex) { Response.StatusCode = 500; Westwind.Web.CallbackException exception = new Westwind.Web.CallbackException(); exception.message = ex.GetBaseException().Message; if (HttpContext.IsDebuggingEnabled) { exception.stackTrace = ex.StackTrace; } exception.isCallbackError = true; // return result based on ?Format= return(this.ApiResult(exception)); }
protected ActionResult ExceptionResult(string message) { Response.StatusCode = 500; Westwind.Web.CallbackException exception = new Westwind.Web.CallbackException(); exception.message = message; exception.isCallbackError = true; // return result based on ?Format= return this.ApiResult(exception); }
protected ActionResult ExceptionResult(Exception ex) { Response.StatusCode = 500; Westwind.Web.CallbackException exception = new Westwind.Web.CallbackException(); exception.message = ex.GetBaseException().Message; if (HttpContext.IsDebuggingEnabled) exception.stackTrace = ex.StackTrace; exception.isCallbackError = true; // return result based on ?Format= return this.ApiResult(exception); }
/// <summary> /// Ensure that exceptions are returned in the API format /// Excpetion is rendered as a Callback Exception /// </summary> /// <param name="filterContext"></param> protected override void OnException(ExceptionContext filterContext) { base.OnException(filterContext); // only handle API results here: Format must be set // otherwise fall through and return if (string.IsNullOrEmpty(this.Format)) return; Response.StatusCode = 500; Westwind.Web.CallbackException exception = new Westwind.Web.CallbackException(); exception.message = filterContext.Exception.Message; if (HttpContext.IsDebuggingEnabled) exception.stackTrace = filterContext.Exception.StackTrace; exception.isCallbackError = true; filterContext.Result = this.ApiResult(exception); filterContext.ExceptionHandled = true; }