'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?
Solution 1:[1]
Re-throw the instance you just caught:
Transaction tx = startTransaction()
try {
tx.doSomething()
tx.commit()
}
catch(ex) {
tx.rollback()
throw ex
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Zeke Marffy |
