Пример #1
0
        public IActionResult Index(ErrorModel errorModel = null)
        {
            var exception = ExceptionError.CreateFromJson(TempData[Name].ToString());

            if (errorModel == null)
            {
                errorModel = new ErrorModel(ViewData[ErrorKeys.StatusCode]?.ToString() ?? "", exception);
            }

            return(View(errorModel));
        }
Пример #2
0
        public IActionResult E()
        {
            var exception = HttpContext.Features.Get <IExceptionHandlerFeature>();

            ViewData[ErrorKeys.StatusCode] = HttpContext.Response.StatusCode;

            if (HostingEnvironment_p.IsDevelopment() && exception != null)
            {
                SetException(exception.Error);
                //TODO: Refactor Error Index view to not be dependent on _LayoutUniversal
                if (exception.Error.Source == ErrorSources.RazorError || exception.Error.Source.Contains("Razor"))
                {
                    var simpleException = new
                    {
                        Message    = exception.Error.Message,
                        StackTrace = exception.Error.StackTrace,
                    };
                    return(new JsonResult(simpleException));
                }
            }
            var exceptionError = ExceptionError.CreateFromJson(TempData[Name].ToString());

            return(View(ActionNames.Index, new ErrorModel(ViewData[ErrorKeys.StatusCode]?.ToString() ?? "", exceptionError)));
        }