mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-19 06:53:26 +08:00
[PreviewHandlers]Ignore telemetry exceptions (#28612)
This commit is contained in:
parent
b471c98f7e
commit
e09839dd6e
@ -78,7 +78,13 @@ namespace Microsoft.PowerToys.PreviewHandler.Gcode
|
||||
|
||||
Resize += FormResized;
|
||||
base.DoPreview(fs);
|
||||
PowerToysTelemetry.Log.WriteEvent(new GcodeFilePreviewed());
|
||||
try
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new GcodeFilePreviewed());
|
||||
}
|
||||
catch
|
||||
{ // Should not crash if sending telemetry is failing. Ignore the exception.
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -148,7 +154,14 @@ namespace Microsoft.PowerToys.PreviewHandler.Gcode
|
||||
/// <param name="dataSource">Stream reference to access source file.</param>
|
||||
private void PreviewError<T>(Exception exception, T dataSource)
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new GcodeFilePreviewError { Message = exception.Message });
|
||||
try
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new GcodeFilePreviewError { Message = exception.Message });
|
||||
}
|
||||
catch
|
||||
{ // Should not crash if sending telemetry is failing. Ignore the exception.
|
||||
}
|
||||
|
||||
Controls.Clear();
|
||||
_infoBarAdded = true;
|
||||
AddTextBoxControl(Properties.Resource.GcodeNotPreviewedError);
|
||||
|
@ -200,11 +200,23 @@ namespace Microsoft.PowerToys.PreviewHandler.Markdown
|
||||
}
|
||||
});
|
||||
|
||||
PowerToysTelemetry.Log.WriteEvent(new MarkdownFilePreviewed());
|
||||
try
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new MarkdownFilePreviewed());
|
||||
}
|
||||
catch
|
||||
{ // Should not crash if sending telemetry is failing. Ignore the exception.
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new MarkdownFilePreviewError { Message = ex.Message });
|
||||
try
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new MarkdownFilePreviewError { Message = ex.Message });
|
||||
}
|
||||
catch
|
||||
{ // Should not crash if sending telemetry is failing. Ignore the exception.
|
||||
}
|
||||
|
||||
Controls.Clear();
|
||||
_infoBarDisplayed = true;
|
||||
|
@ -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);
|
||||
|
@ -143,7 +143,13 @@ namespace Microsoft.PowerToys.PreviewHandler.Svg
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new SvgFilePreviewError { Message = ex.Message });
|
||||
try
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new SvgFilePreviewError { Message = ex.Message });
|
||||
}
|
||||
catch
|
||||
{ // Should not crash if sending telemetry is failing. Ignore the exception.
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
@ -160,7 +166,13 @@ namespace Microsoft.PowerToys.PreviewHandler.Svg
|
||||
AddWebViewControl(svgData);
|
||||
Resize += FormResized;
|
||||
base.DoPreview(dataSource);
|
||||
PowerToysTelemetry.Log.WriteEvent(new SvgFilePreviewed());
|
||||
try
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new SvgFilePreviewed());
|
||||
}
|
||||
catch
|
||||
{ // Should not crash if sending telemetry is failing. Ignore the exception.
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -288,7 +300,14 @@ namespace Microsoft.PowerToys.PreviewHandler.Svg
|
||||
/// <param name="dataSource">Stream reference to access source file.</param>
|
||||
private void PreviewError<T>(Exception exception, T dataSource)
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new SvgFilePreviewError { Message = exception.Message });
|
||||
try
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new SvgFilePreviewError { Message = exception.Message });
|
||||
}
|
||||
catch
|
||||
{ // Should not crash if sending telemetry is failing. Ignore the exception.
|
||||
}
|
||||
|
||||
Controls.Clear();
|
||||
_infoBarAdded = true;
|
||||
AddTextBoxControl(Properties.Resource.SvgNotPreviewedError);
|
||||
|
Loading…
Reference in New Issue
Block a user