-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated unhandled exception handler in UI
- Loading branch information
Showing
8 changed files
with
64 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
<Fluxor.Blazor.Web.StoreInitializer /> | ||
<Router AppAssembly="@typeof(Main).Assembly"> | ||
<Found Context="routeData"> | ||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" /> | ||
<FocusOnNavigate RouteData="@routeData" Selector="h1" /> | ||
</Found> | ||
<NotFound> | ||
<LayoutView Layout="@typeof(MainLayout)"> | ||
<p role="alert">Sorry, there's nothing at this address.</p> | ||
</LayoutView> | ||
</NotFound> | ||
</Router> | ||
<UnhandledExceptionHandler> | ||
<Fluxor.Blazor.Web.StoreInitializer /> | ||
|
||
<Router AppAssembly="@typeof(Main).Assembly"> | ||
<Found Context="routeData"> | ||
<RouteView DefaultLayout="@typeof(MainLayout)" RouteData="@routeData" /> | ||
<FocusOnNavigate RouteData="@routeData" Selector="h1" /> | ||
</Found> | ||
<NotFound> | ||
<LayoutView Layout="@typeof(MainLayout)"> | ||
<p role="alert">Sorry, there's nothing at this address.</p> | ||
</LayoutView> | ||
</NotFound> | ||
</Router> | ||
</UnhandledExceptionHandler> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@inherits ErrorBoundary | ||
|
||
@if (CurrentException is null) | ||
{ | ||
@ChildContent | ||
} | ||
else if (ErrorContent is not null) | ||
{ | ||
@ErrorContent(CurrentException) | ||
} | ||
else | ||
{ | ||
<div class="page"> | ||
@ChildContent | ||
|
||
<div class="blazor-error-boundary"></div> | ||
</div> | ||
} |
21 changes: 21 additions & 0 deletions
21
src/EventLogExpert/Shared/UnhandledExceptionHandler.razor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// // Copyright (c) Microsoft Corporation. | ||
// // Licensed under the MIT License. | ||
|
||
using EventLogExpert.Eventing.Helpers; | ||
using Microsoft.AspNetCore.Components; | ||
using Microsoft.AspNetCore.Components.Web; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace EventLogExpert.Shared; | ||
|
||
public partial class UnhandledExceptionHandler : ErrorBoundary | ||
{ | ||
[Inject] private ITraceLogger TraceLogger { get; set; } = null!; | ||
|
||
protected override Task OnErrorAsync(Exception exception) | ||
{ | ||
TraceLogger.Trace($"Unhandled exception in UI:\r\n{exception}", LogLevel.Critical); | ||
|
||
return base.OnErrorAsync(exception); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters