Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't throw an exception when the handlebars template reference an not existing property #22

Open
yannisgu opened this issue Jun 14, 2017 · 2 comments

Comments

@yannisgu
Copy link

At the moment when a handlbars template uses a not existing property, Veil will crash.
So when I have the following expression:

{{myProp}}

But there is no {{myProp}} Veil will throw an Exception ("Unable to parse model expression", https://github.com/csainty/Veil/blob/master/src/Veil.Handlebars/HandlebarsExpressionParser.cs#L57).
In our case it would be much better if this expression would be treated as null value.
Why? We develop the handlbars templates and the according models are developed by different people. We want that properties can be added to the handlbars template, but added later to the model, without to break our mainline.

Therefor I propose to change this, so that when a member doesn't exist, Veil treats it as null-String.

In order to do this we would need to make the following additions to Veil:

What do you think?

@csainty
Copy link
Owner

csainty commented Jun 26, 2017

I can see the value in this, though I am not sure I would want that as standard behaviour. It will silently hide typos in the templates which will be hard to track down.

Made configurable though, I see no reason not to support it.

@yannisgu
Copy link
Author

Cool - what would be your favored way to configure this? Constructor ofVeilEngine?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants