Add a bit of exception handling to headpats/hugs buttons

This commit is contained in:
Nikolay Kuznetsov 2021-07-16 01:57:13 +02:00
parent a6321a9ecc
commit 8160521d10

View file

@ -1,3 +1,4 @@
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Windows;
@ -50,12 +51,32 @@ namespace VRCMelonAssistant.Pages
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);
});
}
}
}
}