mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
New: (Avistaz) Better error reporting for unauthorized tests
Fixes #822
This commit is contained in:
@@ -46,6 +46,11 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
|
||||
public List<AvistazRelease> Data { get; set; }
|
||||
}
|
||||
|
||||
public class AvistazErrorResponse
|
||||
{
|
||||
public string Message { get; set; }
|
||||
}
|
||||
|
||||
public class AvistazIdInfo
|
||||
{
|
||||
public string Tmdb { get; set; }
|
||||
|
@@ -89,6 +89,22 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
|
||||
{
|
||||
await GetToken();
|
||||
}
|
||||
catch (HttpException ex)
|
||||
{
|
||||
if (ex.Response.StatusCode == HttpStatusCode.Unauthorized)
|
||||
{
|
||||
_logger.Warn(ex, "Unauthorized request to indexer");
|
||||
|
||||
var jsonResponse = new HttpResponse<AvistazErrorResponse>(ex.Response);
|
||||
return new ValidationFailure(string.Empty, jsonResponse.Resource?.Message ?? "Unauthorized request to indexer");
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Warn(ex, "Unable to connect to indexer");
|
||||
|
||||
return new ValidationFailure(string.Empty, "Unable to connect to indexer, check the log for more details");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Warn(ex, "Unable to connect to indexer");
|
||||
|
Reference in New Issue
Block a user