From e16c54940ef84685b291c71360ca0bf98d7a1e63 Mon Sep 17 00:00:00 2001 From: Citrinate Date: Fri, 15 Mar 2024 19:30:52 -0400 Subject: [PATCH] Improve log clarity --- BoosterManager/Boosters/BoosterPageResponse.cs | 8 ++++---- BoosterManager/Boosters/BoosterQueue.cs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/BoosterManager/Boosters/BoosterPageResponse.cs b/BoosterManager/Boosters/BoosterPageResponse.cs index 111a403..98e439f 100644 --- a/BoosterManager/Boosters/BoosterPageResponse.cs +++ b/BoosterManager/Boosters/BoosterPageResponse.cs @@ -25,6 +25,7 @@ internal BoosterPageResponse(Bot bot, IDocument? boosterPage) { MatchCollection gooAmounts = Regex.Matches(boosterPage.Source.Text, "(?<=parseFloat\\( \")[0-9]+"); Match info = Regex.Match(boosterPage.Source.Text, "\\[\\{\"[\\s\\S]*\"}]"); + if (!info.Success || (gooAmounts.Count != 3)) { Bot.ArchiLogger.LogGenericError(string.Format(Strings.ErrorParsingObject, boosterPage)); @@ -38,11 +39,10 @@ internal BoosterPageResponse(Bot bot, IDocument? boosterPage) { IEnumerable? enumerableBoosters; try { enumerableBoosters = JsonSerializer.Deserialize>(info.Value); - } catch (JsonException ex) { - Bot.ArchiLogger.LogGenericError(ex.Message); - - throw new Exception(); + } catch (JsonException) { + throw; } + if (enumerableBoosters == null) { Bot.ArchiLogger.LogNullError(enumerableBoosters); diff --git a/BoosterManager/Boosters/BoosterQueue.cs b/BoosterManager/Boosters/BoosterQueue.cs index b467253..2eb0af3 100644 --- a/BoosterManager/Boosters/BoosterQueue.cs +++ b/BoosterManager/Boosters/BoosterQueue.cs @@ -56,7 +56,7 @@ private async Task Run() { } if (!await UpdateBoosterInfos().ConfigureAwait(false)) { - Bot.ArchiLogger.LogGenericError("Failed to update booster information"); + Bot.ArchiLogger.LogGenericError("Failed to update booster information, will retry in 1 minute"); UpdateTimer(DateTime.Now.AddMinutes(1)); return;