private Task DisplayRuntimeException(HttpContext context, Exception ex) { var request = context.Request; var model = new ErrorPageModel { Options = _options, ErrorDetails = GetErrorDetails(ex).Reverse(), Query = request.Query, Cookies = request.Cookies, Headers = request.Headers }; var errorPage = new ErrorPage(model); return errorPage.ExecuteAsync(context); }
// Assumes the response headers have not been sent. If they have, still attempt to write to the body. private void DisplayException(HttpContext context, Exception ex) { var request = context.Request; ErrorPageModel model = new ErrorPageModel() { Options = _options, }; if (_options.ShowExceptionDetails) { model.ErrorDetails = GetErrorDetails(ex, _options.ShowSourceCode).Reverse(); } if (_options.ShowQuery) { model.Query = request.Query; }/* TODO: if (_options.ShowCookies) { model.Cookies = request.Cookies; }*/ if (_options.ShowHeaders) { model.Headers = request.Headers; }/* TODO: if (_options.ShowEnvironment) { model.Environment = context; }*/ var errorPage = new ErrorPage() { Model = model }; errorPage.Execute(context); }