data_hope data_hope - 2 months ago 16
Groovy Question

Re-raising an exception in Groovy

I have a groovy-script with a try-catch statement. Now I would like to re-raise the exception, so that the caller can also react to that exception. Is there a canonical way to do this?

Answer

An example of what you have would be nice...

But do you mean something like:

Transaction tx = startTransaction()
try {
    tx.doSomething()
    tx.commit()
}
catch(ex) {
    tx.rollback()
    throw ex
}
Comments