private void UnwrapException(Exception e) { var flatten = FlattenException(e); foreach (var ie in flatten) { SystemErrorType += ie.GetType().FullName + Environment.NewLine; SystemErrorMessage += ie.Message + Environment.NewLine; } SystemErrorType = SystemErrorType.TrimEnd(); SystemErrorMessage = SystemErrorMessage.TrimEnd(); SystemErrorStack = e.StackTrace; }
private HttpResponseMessage GetResponseMessage(HttpActionExecutedContext actionExecutedContext) { if (actionExecutedContext == null) { throw new ArgumentNullException(nameof(actionExecutedContext)); } var msg = new ExceptionHandler().Log(actionExecutedContext.Request.Properties["MS_HttpContext"] as HttpContextWrapper, actionExecutedContext.Exception); var error = new SystemErrorMessage { ErrorCode = msg.Id, TechnicalDetails = ExceptionHandler.EnableFriendlyErrorPage ? null : actionExecutedContext.Exception.ToString() }; return(actionExecutedContext.Request.CreateResponse(HttpStatusCode.InternalServerError, error)); }