Files
Moonlight/Moonlight/Shared/Components/ErrorBoundaries/GlobalErrorBoundary.razor
2023-06-21 19:15:30 +02:00

66 lines
1.9 KiB
Plaintext

@using Moonlight.App.Services.Sessions
@using Moonlight.App.Helpers
@inherits ErrorBoundary
@inject IdentityService IdentityService
@if (CurrentException is null)
{
@ChildContent
}
else if (ErrorContent is not null)
{
<div class="card card-flush h-md-100">
<div class="card-body d-flex flex-column justify-content-between mt-9 bgi-no-repeat bgi-size-cover bgi-position-x-center pb-0">
<div class="mb-10">
<div class="fs-2hx fw-bold text-gray-800 text-center mb-13">
<span class="me-2">
<TL>Ooops. Your moonlight client is crashed</TL>
</span>
</div>
<div class="text-center">
<TL>This error has been reported to the moonlight team</TL>
</div>
</div>
</div>
</div>
}
else
{
<div class="card card-flush h-md-100">
<div class="card-body d-flex flex-column justify-content-between mt-9 bgi-no-repeat bgi-size-cover bgi-position-x-center pb-0">
<div class="mb-10">
<div class="fs-2hx fw-bold text-gray-800 text-center mb-13">
<span class="me-2">
<TL>Ooops. Your moonlight client is crashed</TL>
</span>
</div>
<div class="text-center">
<TL>This error has been reported to the moonlight team</TL>
</div>
</div>
</div>
</div>
}
@code
{
List<Exception> receivedExceptions = new();
protected override async Task OnErrorAsync(Exception exception)
{
receivedExceptions.Add(exception);
Logger.Error($"An unhanded exception occured:");
Logger.Error(exception);
await base.OnErrorAsync(exception);
}
public new void Recover()
{
receivedExceptions.Clear();
base.Recover();
}
}