using System; using System.Text; using ServiceStack.Razor.Templating; using ServiceStack.Text; namespace ServiceStack.Razor { //The type or namespace name 'Html' does not exist in the namespace 'ServiceStack.Markdown' (are you missing an assembly reference?) public class ErrorViewPage : ViewPageRef { public static string DefaultPageName = "Error"; public static string DefaultContents = @" Error

Oops something went wrong!

{0}

{1}

Stack Trace

{2}
"; private Exception ex; public ErrorViewPage(RazorFormat razorFormat, Exception ex) : base(razorFormat, null, DefaultPageName, ErrorPage(ex, DefaultContents)) { this.ex = ex; } public static string ErrorPage(Exception ex, string template) { var details = ""; var tempEx = ex as TemplateCompilationException; if (tempEx != null) { var sb = new StringBuilder("

Compile Errors

"); foreach (var error in tempEx.Errors) { sb.AppendFormat("

{0}

\n", error.Dump()); } details = sb.ToString(); } return template.Fmt(ex.Message + " (" + ex.GetType().Name + ")", details, ex.StackTrace); } } }