Exemple #1
0
        public ActionResult PostExceptionAsync()
        {
            IExceptionHandlerPathFeature exceptionFeature = HttpContext.Features.Get <IExceptionHandlerPathFeature>();

            //_logger.LogWarning("THIS IS A CUSTOM MESSAGE FROM EXEPTION CONTROLLER");
            //_logger.LogError("THIS IS A CUSTOM MESSAGE FROM EXEPTION CONTROLLER");

            string message = LoggerHelper.GetMessageFromException(exceptionFeature.Error);

            _logger.LogError(exceptionFeature.Error, message);

            return(StatusCode(StatusCodes.Status500InternalServerError, message));
        }