Skip to content

Commit

Permalink
Slightly improved error messages for Github exception, version bump.
Browse files Browse the repository at this point in the history
  • Loading branch information
Friendly0Fire committed Oct 2, 2021
1 parent 34a0e9b commit 56cc4e5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
15 changes: 7 additions & 8 deletions application/GW2 Addon Manager/App/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ void ShowUnhandledException(DispatcherUnhandledExceptionEventArgs e)
e.Handled = true;
LogError(logPath, e);
string errmsg = "An unhandled exception occurred." + "\n" + e.Exception.Message + (e.Exception.InnerException != null ? "\n" + e.Exception.InnerException.Message : "");
if (MessageBox.Show(errmsg, "Critical Error", MessageBoxButton.OK, MessageBoxImage.Error) == MessageBoxResult.OK)
{
Application.Current.Shutdown();
}
if (!(e?.Exception?.InnerException is WebException))
MessageBox.Show(errmsg, "Critical Error", MessageBoxButton.OK, MessageBoxImage.Error);

Application.Current.Shutdown();
}

/// <summary>
Expand All @@ -85,11 +85,10 @@ void ShowUnhandledException(UnhandledExceptionEventArgs e)
LogError(logPath, e);
Exception exc = (Exception) e.ExceptionObject;
string errmsg = "An unhandled exception occurred." + "\n" + exc.Message + (exc.InnerException != null ? "\n" + exc.InnerException.Message : "");
if (MessageBox.Show(errmsg, "Critical Error", MessageBoxButton.OK, MessageBoxImage.Error) == MessageBoxResult.OK)
{
Application.Current.Shutdown();
}
if (!(exc?.InnerException is WebException))
MessageBox.Show(errmsg, "Critical Error", MessageBoxButton.OK, MessageBoxImage.Error);

Application.Current.Shutdown();
}

/// <summary>
Expand Down
13 changes: 6 additions & 7 deletions application/GW2 Addon Manager/Backend/Updating/UpdateHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ public static string DownloadStringFromGithubAPI(this WebClient wc, string url)
try {
return wc.DownloadString(url);
}
catch (WebException)
catch (WebException ex)
{
MessageBox.Show("Github servers returned an error; please try again in a few minutes.", "Github API Error", MessageBoxButton.OK, MessageBoxImage.Error);
Application.Current.Shutdown();
return "";
MessageBox.Show("Github servers returned an error; please try again in a few minutes.\n\nThe error was: " + ex.Message, "Github API Error", MessageBoxButton.OK, MessageBoxImage.Error);
throw ex;
}
}

Expand All @@ -35,9 +34,9 @@ public static void DownloadFileFromGithubAPI(this WebClient wc, string url, stri
try {
wc.DownloadFile(url, destPath);
}
catch (WebException) {
MessageBox.Show("Github servers returned an error; please try again in a few minutes.", "Github API Error", MessageBoxButton.OK, MessageBoxImage.Error);
Application.Current.Shutdown();
catch (WebException ex) {
MessageBox.Show("Github servers returned an error; please try again in a few minutes.\n\nThe error was: " + ex.Message, "Github API Error", MessageBoxButton.OK, MessageBoxImage.Error);
throw ex;
}
}

Expand Down
2 changes: 1 addition & 1 deletion application/GW2 Addon Manager/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.2.0")]
[assembly: AssemblyVersion("1.4.3.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ public string GamePath
{
if (value == _gamePath) return;
SetProperty(ref _gamePath, value);
_configurationManager.UserConfig.GamePath = value;
_configurationManager.SaveConfiguration();

new Configuration(_configurationManager).SetGamePath(_gamePath);
}
}
private string _gamePath;
Expand Down

0 comments on commit 56cc4e5

Please sign in to comment.