21 lines
579 B
C#
21 lines
579 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace WebEMSim.Controllers
|
|
{
|
|
[ApiController]
|
|
[Route("error")]
|
|
public class ErrorController : ControllerBase
|
|
{
|
|
[HttpGet("{statusCode}", Name = "HandleError")]
|
|
public IActionResult Handle(int statusCode)
|
|
{
|
|
if (statusCode == 404)
|
|
{
|
|
var fallbackFile = Path.Combine(Environment.CurrentDirectory, "webem-ui/build/404.html");
|
|
return PhysicalFile(fallbackFile, "text/html");
|
|
}
|
|
|
|
return StatusCode(statusCode);
|
|
}
|
|
}
|
|
}
|