Log Goodreads connection failures with more info.

(cherry picked from commit 6672650b6b5e152e82fb3ad38a0a158d66c0b83d)
pull/2737/head
Taloth Saldono 3 years ago committed by Bogdan
parent 22f92150c3
commit 18253a298e

@ -1,4 +1,5 @@
using System.Net;
using System;
using System.Net;
using NzbDrone.Common.Exceptions;
namespace NzbDrone.Core.Exceptions
@ -13,6 +14,12 @@ namespace NzbDrone.Core.Exceptions
StatusCode = statusCode;
}
public NzbDroneClientException(HttpStatusCode statusCode, string message, Exception innerException, params object[] args)
: base(message, innerException, args)
{
StatusCode = statusCode;
}
public NzbDroneClientException(HttpStatusCode statusCode, string message)
: base(message)
{

@ -1,3 +1,4 @@
using System;
using System.Net;
using NzbDrone.Core.Exceptions;
@ -14,5 +15,10 @@ namespace NzbDrone.Core.MetadataSource.BookInfo
: base(HttpStatusCode.ServiceUnavailable, message, args)
{
}
public BookInfoException(string message, Exception innerException, params object[] args)
: base(HttpStatusCode.ServiceUnavailable, message, innerException, args)
{
}
}
}

@ -1,4 +1,5 @@
using System.Net;
using System;
using System.Net;
using NzbDrone.Core.Exceptions;
namespace NzbDrone.Core.MetadataSource.Goodreads
@ -14,5 +15,10 @@ namespace NzbDrone.Core.MetadataSource.Goodreads
: base(HttpStatusCode.ServiceUnavailable, message, args)
{
}
public GoodreadsException(string message, Exception innerException, params object[] args)
: base(HttpStatusCode.ServiceUnavailable, message, innerException, args)
{
}
}
}

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Net;
using NLog;
using NzbDrone.Common.Http;
using NzbDrone.Core.Http;
@ -43,14 +44,20 @@ namespace NzbDrone.Core.MetadataSource.Goodreads
return response.Resource;
}
catch (HttpException)
catch (HttpException ex)
{
throw new GoodreadsException("Search for '{0}' failed. Unable to communicate with Goodreads.", query);
_logger.Warn(ex);
throw new GoodreadsException("Search for '{0}' failed. Unable to communicate with Goodreads.", ex, query);
}
catch (WebException ex)
{
_logger.Warn(ex);
throw new GoodreadsException("Search for '{0}' failed. Unable to communicate with Goodreads.", ex, query, ex.Message);
}
catch (Exception ex)
{
_logger.Warn(ex, ex.Message);
throw new GoodreadsException("Search for '{0}' failed. Invalid response received from Goodreads.", query);
_logger.Warn(ex);
throw new GoodreadsException("Search for '{0}' failed. Invalid response received from Goodreads.", ex, query);
}
}
}

Loading…
Cancel
Save