Throwing Exception from custom Java function in TIBCO BusinessEvents.
book
Article ID: KB0091123
calendar_today
Updated On:
Products
Versions
TIBCO BusinessEvents Enterprise Edition
-
Not Applicable
-
Description
Resolution: Description: =========== Throwing Exception from custom Java function in TIBCO BusinessEvents .
Environment: =========== All Operating Systems TIBCO BusinessEvents 4.x,5.x
Resolution: =========== TIBCO BusinessEvents supports throwing only RuntimeException from custom Java code . Note that any other exception thrown from custom Java code has to be wrapped as an instance of Runtime Exception.
Custom Function Code :
public static void exceptionThrow() throws RuntimeException { try { int a = 7 / 0; // This line will throw arithmetic exception System.out.println("Quotient" + String.valueOf(a)); } catch (Exception exception) { if (exception instanceof RuntimeException) { throw new RuntimeException(); //Throws runtime exception } else { //Wrap any other exception into an instance of runtime exception before throwing throw new RuntimeException("Not a runtime Exception", exception); } } }