Ejemplo n.º 1
0
        /// <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;
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        /// <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;
        }