Skip to content

Commit d149866

Browse files
committed
feat: Add sentry to automatically report bugs
1 parent e217f7d commit d149866

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

VNGod/App.xaml.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ public App()
1717
DispatcherUnhandledException += App_DispatcherUnhandledException;
1818
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
1919
TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
20+
SentrySdk.Init(o =>
21+
{
22+
// Tells which project in Sentry to send events to:
23+
o.Dsn = "https://df662d1fe5a888d639cbe919b4ab24fd@o4510685531734016.ingest.us.sentry.io/4510685538942976";
24+
// When configuring for the first time, to see what the SDK is doing:
25+
o.Debug = true;
26+
});
2027
}
2128

2229
private void TaskScheduler_UnobservedTaskException(object? sender, UnobservedTaskExceptionEventArgs e)
@@ -28,6 +35,7 @@ private void TaskScheduler_UnobservedTaskException(object? sender, UnobservedTas
2835

2936
private static void HandleRestart(Exception? e)
3037
{
38+
SentrySdk.CaptureException(e!);
3139
if (e != null)
3240
MessageBox.Show("An unexpected error occurred:\n" + e.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
3341
else

VNGod/VNGod.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2828
<PrivateAssets>all</PrivateAssets>
2929
</PackageReference>
30+
<PackageReference Include="Sentry" Version="6.0.0" />
3031
<PackageReference Include="System.Drawing.Common" Version="10.0.0" />
3132
<PackageReference Include="WebDav.Client" Version="2.9.0" />
3233
</ItemGroup>

0 commit comments

Comments
 (0)