Ejemplo n.º 1
0
 public ErrorViewModel GetErrorViewModel(RouteData data, Exception exception, bool ajax = false)
 {
     if (data == null)
     {
         throw new ArgumentNullException("data");
     }
     string controllerName = data.GetControllerString(Error.EmptyController);
     string actionName = data.GetActionString(Error.EmptyAction);
     string errorMessage = GetMessage(exception, ajax);
     ErrorViewModel model = new ErrorViewModel(context, exception, controllerName, actionName, errorMessage);
     return model;
 }
Ejemplo n.º 2
0
 private string GetHtmlResponse(ErrorViewModel model)
 {
     string html = GetEmbeddedHtmlTemplate(Constants.UnrecoverableViewName);
     string htmlForException = model.DisplayException ? GetHtmlException(model.Exception) : string.Empty;
     html = html.Replace(Unrecoverable.ModelTitle, HttpUtility.HtmlEncode(User.FatalException));
     html = html.Replace(Unrecoverable.ModelRefresh, HttpUtility.HtmlEncode(User.Refresh));
     html = html.Replace(Unrecoverable.ModelMessage, HttpUtility.HtmlEncode(model.Message));
     html = html.Replace(Unrecoverable.ModelException, htmlForException);
     return html;
 }