Uh oh!
There was an error while loading. Please reload this page.
Add checks for loose closing blocks - #485
Conversation
Check loose closing blocks on compile time
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| } | ||
| else if (IsLooseClosingElement(item, parentItem, out var looseBlockName)) | ||
| { | ||
| throw new HandlebarsCompilerException($"Loose closing block '{looseBlockName}' was found"); |
There was a problem hiding this comment.
Dropping this in from my mobile to start a conversation; I can follow up with more specific suggestions: I am not sure the exception message or phrase “loose closing block” is clear or actionable enough by itself for many devs. They would need to look that up to understand it. Can we make it more clear what the problem is?
There was a problem hiding this comment.
I see your point and I had worries about the wording. What do you think about "An open element was missed for the closing element '/unless'"?
There was a problem hiding this comment.
Now that we're adding more specific compile-time messages, I'm really wishing I'd added the ability to keep line number and source context :)
"A closing element {{/unless}} was found without a matching open element"?
There was a problem hiding this comment.
Now that we're adding more specific compile-time messages, I'm really wishing I'd added the ability to keep line number and source context :)
@rexm , I've added this some time ago but unfortunately it's not propagated to every corner of the compiler and it still needs some improvement 🙁
In this case, HelperExpression has Context property of type IReaderContext and HandlebarsCompilerException has constructor accepting it as a parameter.
There was a problem hiding this comment.
Oh awesome! I’ll need to look at how that works :)
There was a problem hiding this comment.
The message was updated. Also, I've made renaming for functions and vars to get rid of some ambiguity.
Update error message + make renaming
Kudos, SonarCloud Quality Gate passed! |








Check loose closing blocks on compile time - fixes#484.