rwf2 / Rocket

A web framework for Rust.
https://rocket.rs
Other
23.59k stars 1.52k forks source link

Minijinja2: Improve error reporting #2784

Closed michaelmelanson closed 1 week ago

michaelmelanson commented 1 month ago

This change improves the error reporting for Minijinja2 templates.

Currently, when errors occur in a Minijinja2 template, it usually gives an error message that only has a top-level explanation of the problem. When the issue comes from an included file or a layout, this error message does not include enough details to diagnose the problem when the problem.

With this change, it now prints details about the entire error chain returned, which acts as a stack trace to find the cause of the error.

It also adds the error message on 'template not found' errors.

SergioBenitez commented 1 week ago

Merged in https://github.com/rwf2/Rocket/commit/347d9da663f1184b26b956a25c48e0dadb87cdcb. Thank you!