using System.Net.Http; using System.Threading.Tasks; using Novaloop.PaymoApi.Exceptions; namespace Novaloop.PaymoApi.Extensions { internal static class HttpResponseMessageExtensions { internal static async Task ThrowExceptionWithDetailsIfUnsuccessful(this HttpResponseMessage response) { if (!response.IsSuccessStatusCode) { throw new PaymoApiException((int) response.StatusCode, await response.Content.ReadAsStringAsync()); } } } }