collective / mr.bob

Mister Bob (the builder) is filesystem template renderer
http://mrbob.readthedocs.org/en/latest/
Other
69 stars 30 forks source link

Provide user friendly jinja2 error messages #36

Open domenkozar opened 11 years ago

domenkozar commented 11 years ago

When jinja2 fails (normally due to a refrenced undefined variables), provide a nice traceback.

fgblomqvist commented 10 years ago

Maybe as a start a friendly error message should be printed when no .mrbob config file exists (feels like mr.bob should check for this before passing stuff to jinja)? Currently yields: jinja2.exceptions.UndefinedError: 'author' is undefined

domenkozar commented 10 years ago

Would you mind creating a pull request?

fgblomqvist commented 10 years ago

I'll give it a try tomorrow!

fgblomqvist commented 10 years ago

After having done further analyzing of the code and docs of both mr.bob and the template I was using (bobtemplates.kotti) my view at this has changed. I thought that the .mrbob config was required, I however noticed that it doesn't say that anywhere (and mr.bobs code treats it as optional). The fault of that error I got is the template, since it shouldn't assume the existence of something optional. Worth noting though is that in the docs of the template the author mentions that it requires the author vars so yeah, idk. Anyway, a more general solution to handling these errors is better, like your original idea. I don't feel I'm experienced enough to perform that task though.

domenkozar commented 10 years ago

OK, thanks for taking a look at this