mirror of
https://github.com/bitwarden/server.git
synced 2025-04-07 05:58:13 -05:00
24 lines
646 B
C#
24 lines
646 B
C#
using Microsoft.AspNetCore.Diagnostics;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace Bit.Admin.Controllers;
|
|
|
|
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;
|
|
|
|
if (exceptionHandlerPathFeature != null)
|
|
{
|
|
return Redirect(exceptionHandlerPathFeature.Path);
|
|
}
|
|
else
|
|
{
|
|
return Redirect("/Home");
|
|
}
|
|
}
|
|
}
|