maciejhirsz / ramhorns

Fast Mustache template engine implementation in pure Rust.
https://crates.io/crates/ramhorns
Mozilla Public License 2.0
297 stars 29 forks source link

Confusing result when missing partial files #53

Open JakeShirley opened 3 years ago

JakeShirley commented 3 years ago

Sorry if this isn't 100% correct, I am really new to Rust.

When loading a directory of templates I got an odd error message. I eventually found out it is because my partial templates were not found on disk, but I had no idea which ones! I was able to eventually find it but it was a little cumbersome.

NOTE: My main issue was that I wasn't including the file extension in the partial names.

Example: template.mustache

This is my template: {{> partial_that_isnt_on_disk.mustache}}

Error message:

thread 'main' panicked at 'Failed to load mustache templates: Io(Os { code: 2, kind: NotFound, message: "The system cannot find the file specified." })'
maciejhirsz commented 3 years ago

Are you using latest version? It should have been fixed in #51.

JakeShirley commented 3 years ago

Are you using latest version? It should have been fixed in #51.

Looks like I am using 0.12.0

grego commented 2 years ago

Could you, please, show the piece of code where the panic happened?