On Fri, Nov 28, 2014 at 9:17 PM, Bryn Jeffries <[email protected]> wrote: > Said Vincent: >> > and can this be caught within the Velocity or Groovy code that calls it? >> >> errors are automatically caught in the script macros ({{velocity}}, >> {{groovy}}, etc). > > OK, looks like Groovy has explicit try/catch > (http://groovy.codehaus.org/JN3035-Exceptions). I couldn't see anything about > Velocity catching exceptions (only about Velocity throwing exceptions - > http://velocity.apache.org/engine/devel/developer-guide.html#exceptions).
Yes there is nothing in standard Velocity but XWiki add some tools to Velocity and among other things some try/catching support, see http://extensions.xwiki.org/xwiki/bin/view/Extension/Velocity+Module#HVelocityDirectives. What Vincent meant by automatically caught is that you get to see the error in the error where you have put the {{velocity}} macro, it does not break the whole page. > > So if I have a component that I call from velocity with $mycomponent.foo() > and the method throws an exception (IOException, for instance), can I control > what the Velocity script does about this? > > _______________________________________________ > users mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
