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
+11
View File
@@ -241,6 +241,8 @@ namespace VRCX
/// <param name="Text">The optional text to display in the notification.</param> /// <param name="Text">The optional text to display in the notification.</param>
/// <param name="Image">The optional image 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 = "") public void DesktopNotification(string BoldText, string Text = "", string Image = "")
{
try
{ {
ToastContentBuilder builder = new ToastContentBuilder(); ToastContentBuilder builder = new ToastContentBuilder();
@@ -255,6 +257,15 @@ namespace VRCX
builder.Show(); 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> /// <summary>
/// Restarts the VRCX application for an update by launching a new process with the "/Upgrade" argument and exiting the current process. /// Restarts the VRCX application for an update by launching a new process with the "/Upgrade" argument and exiting the current process.