Features/discord errors (#20)

* catching another http error code.

* more discord logging
This commit is contained in:
James Tombleson 2023-04-03 06:46:35 -07:00 committed by GitHub
parent d23019926b
commit af2f700e41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,9 +63,11 @@ public class DiscordNotificationJob
{ {
//collect all the new requests //collect all the new requests
var requests = _queue.List(25); var requests = _queue.List(25);
_logger.Debug($"{JobName} - Collected {requests.Count} items to send");
foreach (var request in requests) foreach (var request in requests)
{ {
_logger.Debug($"{JobName} - Processing {request.ID}");
// Get all details on the article in the queue // Get all details on the article in the queue
var articleDetails = _article.GetById(request.ArticleID); var articleDetails = _article.GetById(request.ArticleID);
@ -78,7 +80,15 @@ public class DiscordNotificationJob
continue; continue;
} }
var sourceIcon = _icons.GetBySourceId(sourceDetails.ID); var sourceIcon = new IconModel();
try
{
sourceIcon = _icons.GetBySourceId(sourceDetails.ID);
}
catch
{
_logger.Warning($"{JobName} - Source ID '{sourceDetails.ID}' is missing an icon.");
}
// Find all the subscriptions for that source // Find all the subscriptions for that source
var allSubscriptions = _subs.ListBySourceID(sourceDetails.ID); var allSubscriptions = _subs.ListBySourceID(sourceDetails.ID);
@ -112,7 +122,7 @@ public class DiscordNotificationJob
_logger.Debug($"{JobName} - Removing {request.ID} from the queue."); _logger.Debug($"{JobName} - Removing {request.ID} from the queue.");
_queue.Delete(request.ID); _queue.Delete(request.ID);
} }
_logger.Error($"{JobName} - Loop has been completed."); _logger.Information($"{JobName} - Loop has been completed.");
} }
public DiscordMessage GenerateDiscordMessage(SourceModel source, ArticlesModel article, IconModel icon) public DiscordMessage GenerateDiscordMessage(SourceModel source, ArticlesModel article, IconModel icon)