[PreviewHandlers]Ignore telemetry exceptions (#28612)

This commit is contained in:
Jaime Bernardo
2023-09-19 15:41:17 +01:00
committed by GitHub
parent b471c98f7e
commit e09839dd6e
4 changed files with 65 additions and 9 deletions

View File

@@ -161,11 +161,23 @@ namespace Microsoft.PowerToys.PreviewHandler.Pdf
}
}
PowerToysTelemetry.Log.WriteEvent(new PdfFilePreviewed());
try
{
PowerToysTelemetry.Log.WriteEvent(new PdfFilePreviewed());
}
catch
{ // Should not crash if sending telemetry is failing. Ignore the exception.
}
}
catch (Exception ex)
{
PowerToysTelemetry.Log.WriteEvent(new PdfFilePreviewError { Message = ex.Message });
try
{
PowerToysTelemetry.Log.WriteEvent(new PdfFilePreviewError { Message = ex.Message });
}
catch
{ // Should not crash if sending telemetry is failing. Ignore the exception.
}
Controls.Clear();
_infoBar = GetTextBoxControl(Resources.PdfNotPreviewedError);