private void ThrowHttpException(IAPIRestResponse restResponse) { var messageBuilder = new StringBuilder(); var parameters = string.Join(", ", restResponse.Request.Parameters.Select(x => x.Name + "=" + (x.Value ?? "NULL"))); messageBuilder.AppendLine($"Request to {_restClient.BaseUrl.AbsoluteUri}/{restResponse.Request.Resource}"); messageBuilder.AppendLine($"failed with status code {(int)restResponse.StatusCode} - {restResponse.StatusCode}"); messageBuilder.AppendLine($"parameters: {parameters}"); messageBuilder.AppendLine($"and content: {restResponse.Content}"); throw new HttpException((int)restResponse.StatusCode, messageBuilder.ToString()); }
public APIResponseEventContext(IAPIRestResponse restResponse) { RestResponse = restResponse; }