-
Notifications
You must be signed in to change notification settings - Fork 110
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
Added function to disable template rendering abort on error #109
base: master
Are you sure you want to change the base?
Conversation
make Ranger return interface{}, not reflect.Value
fix isset call with chain node argument
support interface{} values in len()
isset: return false when value is nil
isset: only check for nil on values that can be nil
make notNil a top-level function
When recovering from a panic, the runtime (state) was put back into the state pool. The state was then re-used by the next template execution. This led to the pre-crash-context (e. g. variables set on the state via Runtime.Set) being leaked into the next template execution.
Hi, @kabukky thanks for the contribution, can you send multiple pull requests ? |
Hi @jhsx Sorry, my master has diverged quite a bit by now. The relevant changes are all in this commit: I'm still not sure if this is feasible, since it might have side effects. What is your take on it? |
Changed how the state is reset after previous usage
give better out-of-range error message in index expression evaluation
Can you pull out kabukky@b2a337d into a new PR? |
We are currently evaluating Jet for our projects.
One thing that is different from a lot of other template languages (e. g. Handlebars) is how Jet handles expressions that cannot be evaluated.
E. g. accessing a non-valid field value will lead to the whole template rendering process being aborted and the error being returned. Handlebars would just insert an empty string into the place of the expression.
To enable this "Handlebars"-like behavior with Jet, I've added the
abortTemplateOnError
global variable that can be set from the outside viaSetAbortTemplateOnError
.It works well with this template (
document.yada
is not set in this case, the if comparison is also not valid):Do you see any problems with this?
Node.errorf
is used in a lot of other situations that I haven't checked yet