getzola / even

A clean blog theme for Zola
MIT License
72 stars 47 forks source link

Error messages could be improved #51

Closed biquad closed 2 years ago

biquad commented 2 years ago

I have recently started using Zola as the main tool for setting up a new web site with its own template. In general, I have found that it is a breeze to develop a new template in Zola compared to Hugo. The scripting language does (mostly) what you ask it to do making it easier to get a good result.

However, I have run into some few problems here and there with unclear and insufficient error messages. I will list some of them here:

1) Orphaned pages In my first experiments, I frequently had Orphaned pages because the front matter had not been set or it has been set incorrectly. The error messages is just that "there are 23 orphaned pages". Is it be possible to get a list of all the orphaned pages when building? This will make it easier to pin-point the source of the problem(s).

2) Indirect error message without clear source I recently changes the section template and then got the following error message

-> Template changed .../templates/section.html
Reloading only template
Error: Failed to build the site
Error: Failed to render pager 1
Error: Reason: Failed to render 'section.html': error while rendering macro `post_macros::title`
Error: Reason: Filter call 'date' failed
Error: Reason: Filter `date` received an incorrect type for arg `value`: got `Null` but expected i64|u64|String
Done in 16ms.

The message error is clear :-), but there are no indications about which file was the underlying cause for the error. It would be great if there is a way to improve the error messages.

3) Import of macros I believe that import of macros should be done at the start of the [template] file (I am not sure if this is clarified in the documentation for either Zola or Tera). In any case, if you import a macro in the middle of a file, you get an error message like

Error: Failed to build the site
Error: 
* Failed to parse "/home/carsten/web/zola/themes/std/templates/base.html"
  --> 57:3
   |
57 |   {% import "macros/title_or_dir.html" as tord %}
   |   ^---
   |
   = unexpected tag; expected end of input or some content

Could error message be improved so that there is a hint saying the import of macros should be done at the beginning of the file.

Otherwise, I really like Zola - THANKS!

Keats commented 2 years ago

Thanks for the kind words!

  1. I think we can print the first 10 or so. I didn't want to print everything because some people have sites with 100k+ pages and don't want to spam that much when they are starting to move to Zola
  2. Agreed, Tera v2 will have better error messages pointing to the exact line/column but it's not going to happen anytime soon.