scmorrison / uzu

Uzu is a static site generator with built-in web server, file modification watcher, live reload, i18n, themes, multi-page support, inject external data via local Raku module, and external pre/post command execution.
Artistic License 2.0
36 stars 1 forks source link

YAML error messages are not helpful #8

Open evanmiller opened 7 years ago

evanmiller commented 7 years ago

I have a project with ~50 templates. There's an error somewhere in a YAML snippet, but all Uzu tells me is:

Couldn't parse YAML
  in sub build at /Users/emiller/Code/rakudo/install/share/perl6/site/sources/B64B70030D8DC8D24494E45C38BA972A87CF0732 (Uzu::Render) line 267
  in sub MAIN at /Users/emiller/Code/rakudo/install/share/perl6/site/sources/A6A04D2AC064A3AC3AC0CFA1813B60BA00E99C28 (Uzu::CLI) line 38
  in block <unit> at /Users/emiller/Code/rakudo/install/share/perl6/site/resources/2FA4F1086B130C49B85739217FDF9182FFBCD515 line 5
  in sub MAIN at /Users/emiller/Code/rakudo/install/share/perl6/site/bin/uzu line 2
  in block <unit> at /Users/emiller/Code/rakudo/install/share/perl6/site/bin/uzu line 2

I would like to know what file is failing, and (ideally) on what line number the parse fails.

scmorrison commented 7 years ago

Hi @evanmiller, I have added a catch to spit out the template name that it dies on for now. I am going to look into a solution for validating the yaml before trying to parse it. YAMLish doesn't support this yet.

Uzu will still die, but you should now see a message like this:

Invalid template yaml [/example_project_tt/pages/index.tt]
evanmiller commented 7 years ago

Thanks, much better! I will leave this open until line numbers are provided.