public ErrorResult GetError(HttpCallException exception) { dynamic details = new { RequestUrl = exception.RequestUri.ToString(), RequestMethod = exception.RequestMethod.Method, ErrorMessage = exception.Message, ResponseBody = GetResponseBody(exception.ResponseBody), StackTrace = exception.StackTrace }; var error = new Error(DefaultInstance, ErrorCode.System.ToString(), exception.Message, details); return(new ErrorResult(error)); }
public ErrorResult GetError(BrokenCircuitException <HttpResponseMessage> exception) { var detailsErrorMessage = HttpCallException.BuildMessage(exception.Result.RequestMessage.RequestUri, exception.Result.RequestMessage.Method, exception.Result.StatusCode, exception.Result.ReasonPhrase); dynamic details = new { RequestUrl = exception.Result.RequestMessage.RequestUri.ToString(), RequestMethod = exception.Result.RequestMessage.Method.Method, ErrorMessage = detailsErrorMessage, ResponseBody = GetResponseBody(exception.Result.Content.ReadAsStringAsync().Result), StackTrace = exception.StackTrace }; var error = new Error(DefaultInstance, ErrorCode.System.ToString(), exception.Message, details); return(new ErrorResult(error)); }