You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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.
At the moment when a handlbars template uses a not existing property, Veil will crash.
So when I have the following expression:
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:
Return an SyntaxTreeExpression.Empty() (new class) instead of throwing the exception
Adding an if for our new EmptyExpressionNode
In this case ParseExpression should return Expression.Constant(null, typeof(string))
What do you think?
The text was updated successfully, but these errors were encountered: