One Star

Call getNextException in talend

Hi,
Does anyone know how to call the getNextException in talend jobs to see the actual error message?
Regards
1 REPLY
Seventeen Stars

Re: Call getNextException in talend

Unfortunately Talend has decided not to do this in its code generator. Thats because we have to help our self.
I assume you have a t<anydb>Output component.
Use the flow Main and extend the flow to a tJavaFlex.
.... tOracleOutput --main--> tJavaFlex
The tJavaFlex has 3 code parts: Begin (here we will add some code), Main (will remain empty) and End (here we will add some code)
For the Begin part:
try {

For the End part:
} catch (Exception e) {
if (e instanceof java.sql.SQLException) {
java.sql.SQLException ne = ((java.sql.SQLException) e).getNextException();
if (ne != null) {
throw new Exception(e.getMessage() + ", next:" + ne.getMessage(), e);
} else {
throw e;
}
} else {
throw e;
}
}