Hi Douglas,
To prevent the ugly exception from showing, it's possible to use the following config option in collection.cfg
:
ui.modern.freemarker.error_format=html
This will display any errors or exception as an html comment and preventing it being rendered for the end user.
Please see the follwong link for more information: https://docs.funnelback.com/15.10/more/extra/ui_modern_freemarker_error_format_collection_cfg.html
Going forward though, it would be best to prevent the exception from happening in the first place by always being defensive when accessing any variable. You can do this by checking it if exists before using it. This is what I commonly do wit
hin my templates:
<#if (s.result.summary)!?has_content>
<#-- you code -->
</#if>
The above makes use of the !
and ?has_content
functions to test if a parameter exists and is not empty.
More info can be found in the freemarker manuals.
http://freemarker.org/docs/dgui_template_exp.html#dgui_template_exp_missing_default
http://freemarker.org/docs/ref_builtins_expert.html#ref_builtin_has_content
Hope this helps.
~Gioan