Generators should be able to surface errors
jbeeko opened this issue · comments
Currently if a generator operates over invalid page data it is not able to express this in a nice way. For example if a post.md
file is missing title
in the top matter this is the result:
An unexpected error happend: Exception has been thrown by the target of an invocation.
... more useless logging which tells you nothing
My first thought was to catch the invocation exception and indicate which page is failing during the generation phase.
That results in this:
The expression for /Users/joergbeekmann/Documents/Fornax/FornaxDemo/generators/post.fsx either couldn't be compiled or experianced a runtime
[11:34:23] '/Users/joergbeekmann/Documents/Fornax/FornaxDemo/_public/posts/post2.html' generation failed
Better, at least you know which page it is. But there is no way for the generator to indicate what is wrong with the markdown on the page. In this case a missing title
.
I propose the load/generate phases be changed to collect editing level errors and surface them in the console. See PR #46 for a proof of concept.
Closed see comments in PR