/// <summary> /// Set General Exception /// </summary> private void SetGeneralExceptionApplicationResponse(HttpActionExecutedContext filterContext) { ExceptionContent contents = new ExceptionContent { Message = string.IsNullOrEmpty(filterContext.Exception.Message) ? "Error occured" : filterContext.Exception.Message }; filterContext.Response = new HttpResponseMessage { StatusCode = System.Net.HttpStatusCode.BadRequest, Content = new StringContent(JsonConvert.SerializeObject(contents)) }; }
private void SetApplicationResponse(HttpActionExecutedContext filterContext) { ExceptionContent contents = new ExceptionContent { Message = filterContext.Exception.Message }; filterContext.Response = new HttpResponseMessage { StatusCode = System.Net.HttpStatusCode.BadRequest, Content = new StringContent(JsonConvert.SerializeObject(contents)) }; }