Skip to content

Commit

Permalink
Add a first-chance exception handler
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillOsenkov committed Sep 2, 2024
1 parent 7d21c90 commit b3c4115
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/StructuredLogViewer.Core/ExceptionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ public class ExceptionHandler
{
public static void Initialize()
{
AppDomain.CurrentDomain.FirstChanceException += CurrentDomain_FirstChanceException;
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
}

private static void CurrentDomain_FirstChanceException(object sender, System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs e)
{
ErrorReporting.ReportException(e.Exception);
}

private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
ErrorReporting.ReportException(e.ExceptionObject as Exception);
Expand Down

0 comments on commit b3c4115

Please sign in to comment.