yavsc/src/Yavsc.Org/Views/Shared/Error.cshtml

41 lines
1.1 KiB
Text
Raw Normal View History

@using Microsoft.AspNetCore.Hosting
@using Yavsc.Models
@inject IWebHostEnvironment Env
@model object
2019-01-01 16:28:47 +00:00
@{
2026-06-04 12:13:37 +01:00
ViewBag.Title = "Error";
2019-01-01 16:28:47 +00:00
}
2023-03-19 17:57:55 +00:00
<h1 class="text-danger">Error.</h1>
@if (Env.IsDevelopment())
2019-01-01 16:28:47 +00:00
{
<h2 class="text-danger">An unhandled exception occurred while processing your request.</h2>
if (Model is Exception exception)
{
<pre class="text-danger">@exception.ToString()</pre>
}
else if (Model is ErrorViewModel errorViewModel && !string.IsNullOrWhiteSpace(errorViewModel.Description))
{
<pre class="text-danger">@errorViewModel.Description</pre>
}
}
else
{
<h2 class="text-danger">An error occurred while processing your request.</h2>
if (Model is ErrorViewModel errorViewModel)
{
if (errorViewModel.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@errorViewModel.RequestId</code>
</p>
}
if (!string.IsNullOrWhiteSpace(errorViewModel.Description))
{
<p class="text-danger">@errorViewModel.Description</p>
}
}
2019-01-01 16:28:47 +00:00
}