2021-08-10 12:28:00 -04:00
|
|
|
|
using Microsoft.AspNetCore.Diagnostics;
|
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Bit.Admin.Controllers;
|
2022-08-29 16:06:55 -04:00
|
|
|
|
|
2021-08-10 12:28:00 -04:00
|
|
|
|
public class ErrorController : Controller
|
|
|
|
|
|
{
|
|
|
|
|
|
[Route("/error")]
|
|
|
|
|
|
public IActionResult Error(int? statusCode = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
var exceptionHandlerPathFeature = HttpContext.Features.Get<IExceptionHandlerPathFeature>();
|
|
|
|
|
|
TempData["Error"] = HttpContext.Features.Get<IExceptionHandlerFeature>()?.Error.Message;
|
2022-08-29 15:53:48 -04:00
|
|
|
|
|
2021-08-10 12:28:00 -04:00
|
|
|
|
if (exceptionHandlerPathFeature != null)
|
2022-08-29 15:53:48 -04:00
|
|
|
|
{
|
2021-08-10 12:28:00 -04:00
|
|
|
|
return Redirect(exceptionHandlerPathFeature.Path);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
return Redirect("/Home");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|