add more informative 404 errors
This commit is contained in:
parent
f31ce6b001
commit
cb9119ac58
@ -299,6 +299,11 @@ namespace SharedLibraryCore.Services
|
|||||||
|
|
||||||
var client = await iqClient.FirstOrDefaultAsync();
|
var client = await iqClient.FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
if (client == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
var foundClient = new
|
var foundClient = new
|
||||||
{
|
{
|
||||||
Client = client,
|
Client = client,
|
||||||
|
@ -34,7 +34,12 @@ namespace WebfrontCore.Controllers
|
|||||||
|
|
||||||
ViewBag.Description = Localization["WEBFRONT_ERROR_DESC"];
|
ViewBag.Description = Localization["WEBFRONT_ERROR_DESC"];
|
||||||
ViewBag.Title = Localization["WEBFRONT_ERROR_TITLE"];
|
ViewBag.Title = Localization["WEBFRONT_ERROR_TITLE"];
|
||||||
return View();
|
return View(exceptionFeature.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IActionResult ResponseStatusCode(int? statusCode = null)
|
||||||
|
{
|
||||||
|
return View(statusCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,8 @@ namespace WebfrontCore
|
|||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
|
||||||
{
|
{
|
||||||
|
app.UseStatusCodePagesWithRedirects("/Home/ResponseStatusCode?statusCode={0}");
|
||||||
|
|
||||||
if (env.EnvironmentName == "Development")
|
if (env.EnvironmentName == "Development")
|
||||||
{
|
{
|
||||||
app.UseDeveloperExceptionPage();
|
app.UseDeveloperExceptionPage();
|
||||||
|
@ -1,6 +1,15 @@
|
|||||||
@{
|
@model Exception
|
||||||
|
@using SharedLibraryCore
|
||||||
|
|
||||||
|
@{
|
||||||
ViewData["Title"] = "Error";
|
ViewData["Title"] = "Error";
|
||||||
}
|
}
|
||||||
|
|
||||||
<h4 class="text-danger">@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_ERROR_GENERIC_TITLE"]</h4>
|
<h4 class="text-danger">@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_ERROR_GENERIC_TITLE"]</h4>
|
||||||
<h4 class="text-danger">@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_ERROR_GENERIC_DESC"]</h4>
|
<h4 class="text-danger">@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_ERROR_GENERIC_DESC"]</h4>
|
||||||
|
<strong class="text-warning">
|
||||||
|
@if (Model != null)
|
||||||
|
{
|
||||||
|
@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_ERROR_CODE"].FormatExt(Model.Message);
|
||||||
|
}
|
||||||
|
</strong>
|
||||||
|
13
WebfrontCore/Views/Shared/ResponseStatusCode.cshtml
Normal file
13
WebfrontCore/Views/Shared/ResponseStatusCode.cshtml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
@model int
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Error";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h4 class="text-danger">@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_ERROR_GENERIC_TITLE"]</h4>
|
||||||
|
<h4 class="text-danger">@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_ERROR_GENERIC_DESC"]</h4>
|
||||||
|
<strong class="text-warning">
|
||||||
|
@if (Model == 404)
|
||||||
|
{
|
||||||
|
@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_ERROR_NOTFOUND"]
|
||||||
|
}
|
||||||
|
</strong>
|
Loading…
Reference in New Issue
Block a user