Personal website
1@*
2 This file is part of NKK.
3
4 NKK is free software: you can redistribute it and/or modify it under the
5 terms of the GNU Affero General Public License as published by the Free
6 Software Foundation, either version 3 of the License, or (at your option)
7 any later version.
8
9 NKK is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
12 more details.
13
14 You should have received a copy of the GNU Affero General Public License
15 along with NKK. If not, see <http://www.gnu.org/licenses/>.
16*@
17
18@page "/Error"
19@using System.Diagnostics
20
21<PageTitle>Error</PageTitle>
22
23<h1 class="text-danger">Error.</h1>
24<h2 class="text-danger">An error occurred while processing your request.</h2>
25
26@if (ShowRequestId) {
27 <p>
28 <strong>Request ID:</strong> <code>@RequestId</code>
29 </p>
30}
31
32<h3>Development Mode</h3>
33<p>
34 Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
35</p>
36<p>
37 <strong>The Development environment shouldn't be enabled for deployed applications.</strong>
38 It can result in displaying sensitive information from exceptions to end users.
39 For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
40 and restarting the app.
41</p>
42
43@code{
44 [CascadingParameter] private HttpContext? HttpContext { get; set; }
45
46 private string? RequestId { get; set; }
47 private bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
48
49 protected override void OnInitialized() =>
50 RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier;
51
52}