mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
Log request failures in Notifiarr
This commit is contained in:
parent
70fb57fc83
commit
f620f92cad
1 changed files with 7 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
using NLog;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Common.Serializer;
|
using NzbDrone.Common.Serializer;
|
||||||
using NzbDrone.Core.Notifications.Webhook;
|
using NzbDrone.Core.Notifications.Webhook;
|
||||||
|
@ -14,10 +15,12 @@ namespace NzbDrone.Core.Notifications.Notifiarr
|
||||||
{
|
{
|
||||||
private const string URL = "https://notifiarr.com";
|
private const string URL = "https://notifiarr.com";
|
||||||
private readonly IHttpClient _httpClient;
|
private readonly IHttpClient _httpClient;
|
||||||
|
private readonly Logger _logger;
|
||||||
|
|
||||||
public NotifiarrProxy(IHttpClient httpClient)
|
public NotifiarrProxy(IHttpClient httpClient, Logger logger)
|
||||||
{
|
{
|
||||||
_httpClient = httpClient;
|
_httpClient = httpClient;
|
||||||
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendNotification(WebhookPayload payload, NotifiarrSettings settings)
|
public void SendNotification(WebhookPayload payload, NotifiarrSettings settings)
|
||||||
|
@ -47,12 +50,14 @@ namespace NzbDrone.Core.Notifications.Notifiarr
|
||||||
switch ((int)responseCode)
|
switch ((int)responseCode)
|
||||||
{
|
{
|
||||||
case 401:
|
case 401:
|
||||||
|
_logger.Error("HTTP 401 - API key is invalid");
|
||||||
throw new NotifiarrException("API key is invalid");
|
throw new NotifiarrException("API key is invalid");
|
||||||
case 400:
|
case 400:
|
||||||
throw new NotifiarrException("Unable to send notification. Ensure Lidarr Integration is enabled & assigned a channel on Notifiarr");
|
throw new NotifiarrException("Unable to send notification. Ensure Lidarr Integration is enabled & assigned a channel on Notifiarr");
|
||||||
case 502:
|
case 502:
|
||||||
case 503:
|
case 503:
|
||||||
case 504:
|
case 504:
|
||||||
|
_logger.Error("Unable to send notification. Service Unavailable");
|
||||||
throw new NotifiarrException("Unable to send notification. Service Unavailable", ex);
|
throw new NotifiarrException("Unable to send notification. Service Unavailable", ex);
|
||||||
case 520:
|
case 520:
|
||||||
case 521:
|
case 521:
|
||||||
|
@ -61,6 +66,7 @@ namespace NzbDrone.Core.Notifications.Notifiarr
|
||||||
case 524:
|
case 524:
|
||||||
throw new NotifiarrException("Cloudflare Related HTTP Error - Unable to send notification", ex);
|
throw new NotifiarrException("Cloudflare Related HTTP Error - Unable to send notification", ex);
|
||||||
default:
|
default:
|
||||||
|
_logger.Error(ex, "Unknown HTTP Error - Unable to send notification");
|
||||||
throw new NotifiarrException("Unknown HTTP Error - Unable to send notification", ex);
|
throw new NotifiarrException("Unknown HTTP Error - Unable to send notification", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue