Example #1
0
 public HttpError(HttpStatusCode statusCode = HttpStatusCode.InternalServerError, string errorMessage = null,
     string errorCode = null, object responseDto = null, HttpError innerException = null)
     : base(errorMessage ?? errorCode ?? statusCode.ToString(), innerException)
 {
     this.Response = responseDto;
     this.ErrorCode = errorCode;
     this.StatusCode = statusCode;
     this.Headers = new Dictionary<string, string>();
     this.StatusDescription = errorCode;
 }
            public Exception HandleException(Exception exception, Guid handlingInstanceId)
            {
                var error = this.FormatErrorMessage(exception, handlingInstanceId);

                var result = new HttpError(error, exception)
                    {
                        StatusCode = this.statusCode
                    };
                if (!string.IsNullOrEmpty(this.errorCode))
                {
                    result.ErrorCode = this.errorCode;
                }

                return result;
            }