Skip to content

Raise an error when the context is missing a required key #586

@redking

Description

@redking

Hey,

I have a query regarding template compilation and missing keys.

I'm currently building a prototype that uses Handlebars for both client- and server-side templating; one of the concerns I have is the issue of errors due to missing or mis-spelled keys in the context. With Handlebars, such errors are only encountered at runtime when the template is evaluated. A missing key is rendered as an empty string, meaning that such mistakes are often difficult to discern in a page constructed from a number of templates.

Is it possible to evaluate templates in some sort of "strict" mode, or to override the way that evaluation is performed, such that a missing key will cause an error to be thrown? This would make it much simpler to find such problems, especially when a template is being edited by multiple developers.

I found a similar issue, but the proposed solution does not appear to work any longer

#318

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions