Files
blog.stevanfreeborn.com/src/Blog/Components/Pages/Error.razor
T

28 lines
643 B
Plaintext
Raw Normal View History

2024-04-02 15:35:57 -05:00
@page "/Error"
@using System.Diagnostics
<PageTitle>Error</PageTitle>
2024-04-10 01:28:38 -05:00
<div class="container">
<h2>Error</h2>
<p>Sorry it's me, not you. It looks like an unhandled error occurred while processing your request.</p>
2024-04-02 15:35:57 -05:00
2024-04-10 01:28:38 -05:00
@if (ShowRequestId)
{
2024-04-02 15:35:57 -05:00
<p>
2024-04-10 01:28:38 -05:00
<strong>Request ID:</strong> <code>@RequestId</code>
2024-04-02 15:35:57 -05:00
</p>
2024-04-10 01:28:38 -05:00
}
</div>
2024-04-02 15:35:57 -05:00
@code{
2024-04-10 01:28:38 -05:00
[CascadingParameter]
private HttpContext? HttpContext { get; set; }
2024-04-02 15:35:57 -05:00
2024-04-10 01:28:38 -05:00
private string? RequestId { get; set; }
private bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
2024-04-02 15:35:57 -05:00
2024-04-10 01:28:38 -05:00
protected override void OnInitialized() =>
RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier;
2024-04-02 15:35:57 -05:00
}