private void OnExceptionBase(ExceptionContext filterContext) { _filterContext = filterContext; _controller = filterContext.Controller as Controller; if (_controller != null) { _message = LogFormatter.FormatErrorMessage(_controller, filterContext.Exception.Message); } _logger.LogError(_message, filterContext.Exception); }
private void GlobalError(string message) { _isRedirect = false; var model = new ErrorModel() { Message = message, IsProduction = SettingsProvider.BaseSettings.IsProduction, ExceptionMessage = LogFormatter.FormatErrorMessage(_controller, _filterContext.Exception.Message) }; _filterContext.Result = new ViewResult { ViewName = "~/Views/Error/Error.cshtml", ViewData = new ViewDataDictionary <ErrorModel>(model) }; }