peterlu
12 years agoChampion
This widget could not be displayed
<#assign test = "" />
<#attempt>
<#assign test2 = test?number />
<#recover>
<#assign test2 = 1 />
</#attempt>
test2 = ${test2}
My thought is simple. If the variable cannot be converted to a number, then set it to 1.
I have installed this test component on my custom testing page.
Here is the story:
When I log in as admin, I do not see any errors. and gets the correct "test2 = 1".
But when I log in as a normal user or when i am a anonymous user, I see errors "This widget could not be displayed".
So why?
attempt / recover is like java try catch, right?