Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

We can put code within a 'finally' clause following a matching 'try' clause, so that if regardless of whether the code in the 'try' clause throws an exception, the code in the finally clause will always execute:

...

Code Block
class MyException extends Exception{}
def z
try{
  try{
    throw new MyException()
    assert false
  }finally{}
}catch(e){
  assert e in MyException
  z= 'been here'
}
assert z == 'been here'

...