Skip to content

Commit

Permalink
Merge pull request WalletWasabi#12684 from Szpoti/updateManager_warni…
Browse files Browse the repository at this point in the history
…ngLog

Use Warning in case of wrong json in UpdateManager
  • Loading branch information
molnard authored Mar 20, 2024
2 parents 1d4c660 + 1ea9806 commit fc97ae3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion WalletWasabi/Services/UpdateManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ private async void UpdateChecker_UpdateStatusChangedAsync(object? sender, Update
Cleanup();
break;
}
catch (InvalidDataException ex)
{
Logger.LogWarning(ex);
}
catch (Exception ex)
{
Logger.LogError($"Getting new update failed with error.", ex);
Expand Down Expand Up @@ -192,7 +196,7 @@ private async Task CopyStreamContentToFileAsync(Stream stream, string filePath,

JObject jsonResponse = JObject.Parse(await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false));

string softwareVersion = jsonResponse["tag_name"]?.ToString() ?? throw new InvalidDataException("Endpoint gave back wrong json data or it's changed.");
string softwareVersion = jsonResponse["tag_name"]?.ToString() ?? throw new InvalidDataException($"Endpoint gave back wrong json data or it's changed.\n{jsonResponse}");

// Make sure there are no non-numeric characters (besides '.') in the version string.
softwareVersion = string.Concat(softwareVersion.Where(c => char.IsDigit(c) || c == '.').ToArray());
Expand Down

0 comments on commit fc97ae3

Please sign in to comment.