1
0
Fork 0
mirror of https://github.com/miawinter98/just-short-it.git synced 2024-11-22 08:19:54 +00:00
just-short-it/Components/Pages/Error.razor

28 lines
737 B
Plaintext

@page "/error"
@using System.Diagnostics
@inject IHttpContextAccessor HttpContextAccessor
<PageTitle>Error</PageTitle>
<section>
<h1 class="text-3xl lg:text-5xl text-error mb-6">Unexpected Error</h1>
<h2 class="text-xl lg:text-2xl text-secondary-content mb-3">
An error occurred while processing your request
</h2>
@if (ShowRequestId) {
<p>
<strong>Request ID:</strong> <code>@RequestId</code>
</p>
}
</section>
@code{
public string? RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
protected override void OnInitialized() =>
RequestId = Activity.Current?.Id ?? HttpContextAccessor.HttpContext?.TraceIdentifier;
}