Skip to content

Commit

Permalink
Add a bit of exception handling to headpats/hugs buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
knah committed Jul 15, 2021
1 parent a6321a9 commit 8160521
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions VRCMelonAssistant/Pages/About.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Windows;
Expand Down Expand Up @@ -50,12 +51,32 @@ private async Task<string> WeebCDN(string type)

private async Task HeadPat()
{
PatImage.Load(await WeebCDN("pats"));
try
{
PatImage.Load(await WeebCDN("pats"));
}
catch (Exception ex)
{
Application.Current.Dispatcher.Invoke(() =>
{
Utils.ShowErrorMessageBox("Oops! Can't get headpats right now!", ex);
});
}
}

private async Task Hug()
{
HugImage.Load(await WeebCDN("hugs"));
try
{
HugImage.Load(await WeebCDN("hugs"));
}
catch (Exception ex)
{
Application.Current.Dispatcher.Invoke(() =>
{
Utils.ShowErrorMessageBox("Oops! Can't get hugs right now!", ex);
});
}
}
}
}

0 comments on commit 8160521

Please sign in to comment.