From 037c056de7cf3642d7c46489e78fd7fb4f4c1ab6 Mon Sep 17 00:00:00 2001 From: ImoutoChan Date: Mon, 30 Sep 2024 16:22:33 +0500 Subject: [PATCH] Better error handling for LoadRegularPost --- Source/WetPicsRebirth/Infrastructure/Engines/BooruEngine.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/WetPicsRebirth/Infrastructure/Engines/BooruEngine.cs b/Source/WetPicsRebirth/Infrastructure/Engines/BooruEngine.cs index 5554db0..4e38308 100644 --- a/Source/WetPicsRebirth/Infrastructure/Engines/BooruEngine.cs +++ b/Source/WetPicsRebirth/Infrastructure/Engines/BooruEngine.cs @@ -56,7 +56,7 @@ async Task 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(); @@ -70,7 +70,7 @@ async Task 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 { @@ -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; } }