Skip to content

Commit f08546c

Browse files
committed
refactor: Exception handling
1 parent b98bd45 commit f08546c

File tree

5 files changed

+443
-288
lines changed

5 files changed

+443
-288
lines changed

src/Everywhere.Windows/Interop/Win32VisualElementContext.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
using Avalonia;
1010
using Avalonia.Controls.ApplicationLifetimes;
1111
using Avalonia.Platform;
12+
using Everywhere.Common;
1213
using Everywhere.Extensions;
14+
using Everywhere.I18N;
1315
using Everywhere.Interop;
1416
using FlaUI.Core;
1517
using FlaUI.Core.AutomationElements;
@@ -114,7 +116,9 @@ public Win32VisualElementContext(INativeHelper nativeHelper, ILogger<Win32Visual
114116
}
115117
catch (Exception ex)
116118
{
117-
_logger.LogError(ex, "Failed to get AutomationElement");
119+
_logger.LogError(
120+
new HandledException(ex, new DirectResourceKey("Failed to get AutomationElement")),
121+
"Failed to get AutomationElement");
118122
}
119123

120124
return null;

src/Everywhere/Common/Entrance.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ private static void InitializeTelemetry()
8888
o.Release = typeof(Entrance).Assembly.GetName().Version?.ToString();
8989

9090
o.UseOpenTelemetry();
91-
o.SetBeforeSend(evt => evt.Exception.Unwarp() is OperationCanceledException or EverywhereException { IsGeneralError: true } ? null : evt);
91+
o.SetBeforeSend(evt => evt.Exception.Unwarp() is OperationCanceledException or HandledException { IsExpected: true } ? null : evt);
9292
o.SetBeforeSendTransaction(transaction => SendOnlyNecessaryTelemetry ? null : transaction);
9393
o.SetBeforeBreadcrumb(breadcrumb => SendOnlyNecessaryTelemetry ? null : breadcrumb);
9494
});

src/Everywhere/Common/EverywhereException.cs

Lines changed: 0 additions & 285 deletions
This file was deleted.

0 commit comments

Comments
 (0)