Skip to content

If helper can generate several syntax errors that aren't very useful #1548

@ErisDS

Description

@ErisDS

If you write a malformed {{#if}} helper with too many arguments, you get weird syntax errors that are different depending on just how you malformed the helper:

{{#if anything_goes_here "string"}}

cannot read property 'includeZero' of undefined

{{#if anything_goes_here undefined}}

Cannot read property 'hash' of undefined

{{#if anything_goes_here null}}

Cannot read property 'hash' of null

Here's a JS Fiddle demonstrating these errors
https://jsfiddle.net/m5a9q3b0/3/

Obviously, the if statement examples are incorrect, but the varied weird errors that get generated are the problem. In Ghost themes we regularly see all 3 of these errors, and it's clear noone understands what they mean or how to fix them.

We just added an ugly workaround to Ghost you can see here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions