public ValidationFailure Test(DiscordNotifierSettings settings) { try { var variables = new StringDictionary(); variables.Add("Lidarr_EventType", "Test"); SendNotification(variables, settings); return(null); } catch (HttpException ex) { if (ex.Response.StatusCode == HttpStatusCode.Unauthorized) { _logger.Error(ex, "API key is invalid: " + ex.Message); return(new ValidationFailure("APIKey", "API key is invalid")); } _logger.Error(ex, "Unable to send test message: " + ex.Message); return(new ValidationFailure("APIKey", "Unable to send test notification")); } catch (Exception ex) { _logger.Error(ex, "Unable to send test notification: " + ex.Message); return(new ValidationFailure("", "Unable to send test notification")); } }
public void SendNotification(StringDictionary message, DiscordNotifierSettings settings) { try { ProcessNotification(message, settings); } catch (DiscordNotifierException ex) { _logger.Error(ex, "Unable to send notification"); throw new DiscordNotifierException("Unable to send notification"); } }