Add try-catch to desktop notification (#839)

This commit is contained in:
Usman Shafiq
2024-07-16 14:39:48 -04:00
committed by GitHub
parent 48ea06758e
commit af0d2bc986

View File

@@ -241,6 +241,8 @@ namespace VRCX
/// <param name="Text">The optional text to display in the notification.</param>
/// <param name="Image">The optional image to display in the notification.</param>
public void DesktopNotification(string BoldText, string Text = "", string Image = "")
{
try
{
ToastContentBuilder builder = new ToastContentBuilder();
@@ -255,6 +257,15 @@ namespace VRCX
builder.Show();
}
catch (System.AccessViolationException ex)
{
logger.Warn(ex, "Unable to send desktop notification");
}
catch (Exception ex)
{
logger.Error(ex, "Unknown error when sending desktop notification");
}
}
/// <summary>
/// Restarts the VRCX application for an update by launching a new process with the "/Upgrade" argument and exiting the current process.