moqui-framework icon indicating copy to clipboard operation
moqui-framework copied to clipboard

Add support for try/catch/finally in XmlActions

Open Destrings2 opened this issue 5 years ago • 1 comments

XmlActions does not have try/catch/finally tags. This is trivial to workaround using a script tag. The codebase itself does it in Wikiservices.xml and SystemMessageServices.xml. I reckon this change might have been considered before, so are there any reasons we don't have try/catch/finally tags? It should help reducing the usage of script tags and it's syntactially easier to read as if doesn't require code-switching

Destrings2 avatar Sep 23 '20 19:09 Destrings2

Most scripts don't need it, but no harm having it there. Just a couple of things:

  1. please sign the AUTHORS file like you've done in other repos
  2. the catch should also have minOccurs=0 for try/finally (yet more rare, but useful sometimes)
  3. define the catch and finally elements under the try element instead of separate with a ref (have been slowly moving more toward this for better scoping of element defs, and various XML editors handle autocomplete suggestions better, have noticed even IntelliJ shows elements that aren't allowed or applicable sometimes, because they are defined globally)

jonesde avatar Sep 27 '20 09:09 jonesde