Skip to content

Commit

Permalink
Add proper error message for failed checksum on package download
Browse files Browse the repository at this point in the history
  • Loading branch information
pizzaboxer committed Jun 30, 2024
1 parent 460ff56 commit b2cfeeb
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 6 deletions.
8 changes: 7 additions & 1 deletion Bloxstrap/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,13 @@ protected override async void OnStartup(StartupEventArgs e)
if (connectionResult is not null)
{
Logger.WriteException(LOG_IDENT, connectionResult);
Frontend.ShowConnectivityDialog("Roblox", Bloxstrap.Resources.Strings.Bootstrapper_Connectivity_Preventing, connectionResult);

Frontend.ShowConnectivityDialog(
Bloxstrap.Resources.Strings.Dialog_Connectivity_UnableToConnect,
Bloxstrap.Resources.Strings.Bootstrapper_Connectivity_Preventing,
connectionResult
);

return;
}

Expand Down
16 changes: 13 additions & 3 deletions Bloxstrap/Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public async Task Run()
else if (ex.GetType() == typeof(AggregateException))
ex = ex.InnerException!;

Frontend.ShowConnectivityDialog("Roblox", message, ex);
Frontend.ShowConnectivityDialog(Strings.Dialog_Connectivity_UnableToConnect, message, ex);

App.Terminate(ErrorCode.ERROR_CANCELLED);
}
Expand Down Expand Up @@ -1461,7 +1461,7 @@ private async Task DownloadPackage(Package package)
string hash = MD5Hash.FromStream(fileStream);

if (hash != package.Signature)
throw new ChecksumFailedException($"Failed to verify download of {packageUrl}\n\nGot signature: {hash}\n\nPackage has been downloaded to {packageLocation}\n\nPlease send the file shown above in a bug report.");
throw new ChecksumFailedException($"Failed to verify download of {packageUrl}\n\nExpected hash: {package.Signature}\nGot hash: {hash}");

App.Logger.WriteLine(LOG_IDENT, $"Finished downloading! ({totalBytesRead} bytes total)");
break;
Expand All @@ -1471,7 +1471,17 @@ private async Task DownloadPackage(Package package)
App.Logger.WriteLine(LOG_IDENT, $"An exception occurred after downloading {totalBytesRead} bytes. ({i}/{maxTries})");
App.Logger.WriteException(LOG_IDENT, ex);

if (i >= maxTries || ex.GetType() == typeof(ChecksumFailedException))
if (ex.GetType() == typeof(ChecksumFailedException))
{
Frontend.ShowConnectivityDialog(
Strings.Dialog_Connectivity_UnableToDownload,
String.Format(Strings.Dialog_Connectivity_UnableToDownloadReason, "[https://github.com/pizzaboxer/bloxstrap/wiki/Bloxstrap-is-unable-to-download-Roblox](https://github.com/pizzaboxer/bloxstrap/wiki/Bloxstrap-is-unable-to-download-Roblox)"),
ex
);

App.Terminate(ErrorCode.ERROR_CANCELLED);
}
else if (i >= maxTries)
throw;

if (File.Exists(packageLocation))
Expand Down
20 changes: 19 additions & 1 deletion Bloxstrap/Resources/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion Bloxstrap/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ Click for more information</value>
<value>Connectivity error</value>
</data>
<data name="Dialog.Connectivity.UnableToConnect" xml:space="preserve">
<value>Bloxstrap is unable to connect to {0}</value>
<value>Bloxstrap is unable to connect to Roblox</value>
</data>
<data name="Dialog.Exception.CopyLogContents" xml:space="preserve">
<value>Copy log contents</value>
Expand Down Expand Up @@ -1061,4 +1061,10 @@ Scroll for more languages.</value>
<data name="Menu.FastFlags.Presets.DisableTerrainTextures.Title" xml:space="preserve">
<value>Disable terrain textures</value>
</data>
<data name="Dialog.Connectivity.UnableToDownload" xml:space="preserve">
<value>Bloxstrap is unable to download Roblox</value>
</data>
<data name="Dialog.Connectivity.UnableToDownloadReason" xml:space="preserve">
<value>Roblox cannot be downloaded at this time. Please read the following help page for more information: {0}</value>
</data>
</root>

0 comments on commit b2cfeeb

Please sign in to comment.