×

Please give details of the problem

Skip to content

How to handle errors

The equivalent of js script:

Code

1
2
3
4
5
try {  
/* script1 */  
} catch {  
/* script2 */  
}

could be written in freemarker like this :

Code

1
2
3
4
5
<#attempt>  
  <#-- script1 -->  
<#recover>  
  <#-- script2, if script1 throws an error -->  
<!--#recover-->