public string Generate(Topic topic)
{
if (topic.IsSplashPage())
{
return _transformer.Transform(topic, new FileSystem().ReadStringFromFile(topic.File));
}
try
{
return generate(topic);
}
catch (Exception e)
{
ConsoleWriter.Write(ConsoleColor.Yellow, "Failed to transform topic at " + topic.File);
ConsoleWriter.Write(ConsoleColor.Red, e.ToString());
var document = new HtmlDocument
{
Title = "Error!"
};
document.Add("h1").Text("Error!");
document.Add("pre").Text(e.ToString());
return document.ToString();
}
}