Files
Partsource/PartSource.Api/Controllers/ErrorController.cs
2020-07-26 22:05:42 -04:00

36 lines
904 B
C#

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace PartSource.Api.Controllers
{
[Route("[controller]")]
public class ErrorController : ControllerBase
{
[HttpGet]
[Route("")]
[AllowAnonymous]
public ActionResult Get()
{
IExceptionHandlerPathFeature exceptionFeature = HttpContext.Features.Get<IExceptionHandlerPathFeature>();
if (exceptionFeature != null)
{
string route = exceptionFeature.Path;
Exception ex = exceptionFeature.Error;
//TODO: Logging
}
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
}