Jinja2 Falles Silently When Variable Not Passed-I would prefer to get an error

I have a template like:

<p>
      {{b_key}}
</p>

However, I'm not passing the b_key to the template as so:

return render_template('silent_error_when_var_not_passed.html')

I would expect Jinja2 to raise and exception when the b_key variable is not passed, but it's running without showing anything.

Why is that? Is there a way to make Jinja2 raise an error when a variable is not passed? I've looked around, but I can't seem to find anything that explains this behavior.

Thank you for your heplp :)



Read more here: https://stackoverflow.com/questions/68471065/jinja2-falles-silently-when-variable-not-passed-i-would-prefer-to-get-an-error

Content Attribution

This content was originally published by VFR292 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: