Exemplo n.º 1
0
        private Task HandleExceptionAsync(HttpContext httpContext, Exception exception)
        {
            var applicationError = ApplicationError.From(exception);

            _logger.LogError(applicationError, applicationError.Message);

            httpContext.Response.StatusCode  = applicationError.StatusCode;
            httpContext.Response.ContentType = "application/json";
            return(httpContext.Response.WriteAsync(ApplicationError.From(exception).ToString()));
        }