You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
579 B
27 lines
579 B
using Flurl.Http;
|
|
|
|
namespace Recyclarr.Cli.Processors.ErrorHandling;
|
|
|
|
public class ServiceErrorMessageExtractor(FlurlHttpException e) : IServiceErrorMessageExtractor
|
|
{
|
|
public HttpRequestError? HttpError
|
|
{
|
|
get
|
|
{
|
|
if (e.InnerException is not HttpRequestException http)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
return http.HttpRequestError;
|
|
}
|
|
}
|
|
|
|
public async Task<string> GetErrorMessage()
|
|
{
|
|
return await e.GetResponseStringAsync();
|
|
}
|
|
|
|
public int? HttpStatusCode => e.StatusCode;
|
|
}
|