From 43e06f4b1b7ead9f8cc97fe547eb49d51f341486 Mon Sep 17 00:00:00 2001 From: Rory& Date: Sat, 20 Jan 2024 08:34:32 +0100 Subject: Initial commit --- SystemdCtl/Components/Pages/Error.razor | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 SystemdCtl/Components/Pages/Error.razor (limited to 'SystemdCtl/Components/Pages/Error.razor') diff --git a/SystemdCtl/Components/Pages/Error.razor b/SystemdCtl/Components/Pages/Error.razor new file mode 100644 index 0000000..7a84043 --- /dev/null +++ b/SystemdCtl/Components/Pages/Error.razor @@ -0,0 +1,36 @@ +@page "/Error" +@using System.Diagnostics + +Error + +

Error.

+

An error occurred while processing your request.

+ +@if (ShowRequestId) +{ +

+ Request ID: @RequestId +

+} + +

Development Mode

+

+ Swapping to Development environment will display more detailed information about the error that occurred. +

+

+ The Development environment shouldn't be enabled for deployed applications. + It can result in displaying sensitive information from exceptions to end users. + For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development + and restarting the app. +

+ +@code{ + [CascadingParameter] + private HttpContext? HttpContext { get; set; } + + private string? RequestId { get; set; } + private bool ShowRequestId => !string.IsNullOrEmpty(RequestId); + + protected override void OnInitialized() => + RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier; +} -- cgit 1.4.1