Example #1
0
        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);
        }
Example #2
0
        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)
            };
        }