Added function to disable template rendering abort on error#109
Open
kabukky wants to merge 18 commits intoCloudyKit:masterfrom
Open
Added function to disable template rendering abort on error#109kabukky wants to merge 18 commits intoCloudyKit:masterfrom
kabukky wants to merge 18 commits intoCloudyKit:masterfrom
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.
Member
|
Hi, @kabukky thanks for the contribution, can you send multiple pull requests ? |
Author
|
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
Member
|
Can you pull out kabukky@b2a337d into a new PR? |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
abortTemplateOnErrorglobal variable that can be set from the outside viaSetAbortTemplateOnError.It works well with this template (
document.yadais not set in this case, the if comparison is also not valid):Do you see any problems with this?
Node.errorfis used in a lot of other situations that I haven't checked yet