public override void OnException(HttpActionExecutedContext context) { var result = new ApiResult(context.Request, 1000, context.Exception.Message.ToString(), null); var ex = result.Execute(); context.Response = ex; }