This repository has been archived on 2025-05-19. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
novaloop.paymoapi/src/Extensions/HttpResponseMessageExtensions.cs

17 lines
516 B
C#

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 ApiException((int) response.StatusCode, await response.Content.ReadAsStringAsync());
}
}
}
}