Skip to content

Commit

Permalink
Better error handling for LoadRegularPost
Browse files Browse the repository at this point in the history
  • Loading branch information
ImoutoChan committed Sep 30, 2024
1 parent 90f4f81 commit 037c056
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Source/WetPicsRebirth/Infrastructure/Engines/BooruEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async Task<LoadedPost> LoadPostCore()

var loaded = IsUgoira(post)
? await LoadPostFromUgoira(post.OriginalUrl!)
: await LoadRegularPost(mediaUrl);
: await LoadRegularPost(mediaUrl, post);

var author = post.Tags.Where(x => x.Type == "artist").Select(x => x.Name).FirstOrDefault();

Expand All @@ -70,7 +70,7 @@ async Task<LoadedPost> LoadPostCore()
private static bool IsUgoira(Imouto.BooruParser.Post post)
=> post.OriginalUrl?.EndsWith(".zip") == true;

private async Task<(Stream Stream, long Length)> LoadRegularPost(string mediaUrl)
private async Task<(Stream Stream, long Length)> LoadRegularPost(string mediaUrl, Imouto.BooruParser.Post post)
{
try
{
Expand All @@ -87,7 +87,7 @@ private static bool IsUgoira(Imouto.BooruParser.Post post)
}
catch (Exception e)
{
_logger.LogError(e, "Failed to load media from {MediaUrl}", mediaUrl);
_logger.LogError(e, "Failed to load media from {MediaUrl} ({Md5}) ", mediaUrl, post.Id.Md5Hash);
throw;
}
}
Expand Down

0 comments on commit 037c056

Please sign in to comment.