Freemarker error when webuisupport to request label
Hey there,
the last days I ran into a strange issue. I set up a new Blog and some pre-defined labels to it. Well, as you can imagine, there is no content at this point.
So, when I go to the BlogPage quilt (with "label-name" in path), my Freemarker code failed and returns an error:
Java method "lithium.coreapi.webui.template.models.NamedValueByNameTemplateModel.get(String)" threw an exception when invoked on lithium.coreapi.webui.template.models.NamedValueByNameTemplateModel object "lithium.coreapi.webui.template.models.NamedValueByNameTemplateModel@50b58b98"; see cause exception in the Java stack trace. ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign categoryFilter = webuisupport... [in template "rexroth-hero" at line 31, column 5] ----
The LOC that raises the error, makes use of the webuisupport context object:
<#assign labelSelected = webuisupport.path.parameters.name.get("label-name").text />
I already tried to split up my variables a bit more (adding some checks and so on), but the result is still the same.
The issue only occurs if there are no messages with the requested label are available. Does anyone of run into the same issue and has an idea how to solve this without setting hard coded labels?
Thanks and best regards,
Christian
Are you looking to treat this situation differently or just to prevent the error from being thrown?
I would simply wrap the webuisupport code into an <attempt> block to achieve the latter...