Initial commit
This commit is contained in:
33
PartSource.Api/Controllers/ErrorController.cs
Normal file
33
PartSource.Api/Controllers/ErrorController.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
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
|
||||
{
|
||||
[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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user