The Velocity #try() directive now accepts an optional parameter to specify the name of a Velocity variable into which to save the caught exception. For example:
{{velocity}}
#try("myexception")
$services.query.xwql("zzzzz").execute()
#end
#if ($myexception != '')
... do something...
#end
{{/velocity}}
#try("myexception")
$services.query.xwql("zzzzz").execute()
#end
#if ($myexception != '')
... do something...
#end
{{/velocity}}