Example #1
0
        public override void Handle(ExceptionHandlerContext context)
        {
            HttpStatusCode      statusCode = HttpStatusCodeHelper.GetHttpStatusCode(context.Exception);
            HttpResponseMessage response   = context.Request.CreateResponse(statusCode, new BaseApiResponse(context.Exception));

            context.Result = new ErrorHttpActionResult(response);
        }
Example #2
0
        public override void OnException(HttpActionExecutedContext context)
        {
            if (context.Exception != null)
            {
                HttpStatusCode statusCode = HttpStatusCodeHelper.GetHttpStatusCode(context.Exception);
                context.Response = context.Request.CreateResponse(statusCode, new BaseApiResponse(context.Exception));
            }

            base.OnException(context);
        }