New: (Avistaz) Better error reporting for unauthorized tests

Fixes #822
pull/824/head
Qstick 3 years ago
parent a0d5421dc8
commit a637677ec4

@ -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");

Loading…
Cancel
Save