Call getNextException in talend

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
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;
}
}

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Downloads and Trials

Test drive Talend's enterprise products.

Downloads