One Star

catch exception

I am wondering what is the proper mechanism in Talend to catch exception.
I have a sub-job that has the tMSSqlSP component used to call a stored procedure. When a SQL exception occurred during the call, the entire job dies.
I have added tLogCatcher on the parent- and sub-job, and also added in the parent job, to route to a component like tJava with the "on SubjobError" trigger on the sub-job. I can see data flows through the tLogCatcher and this "subjob error" trigger, but the parent job still dies.
How can I catch the exception and handle it properly (such as sending out an email) but my main job/process does not die (it is designed to listening some ActiveMQ messages for processing)?
Thanks
2 REPLIES
Moderator

Re: catch exception

Hi,
You can create two jobs one is parent and the other is child so that there is an option "Die on child error "(clear this check box to execute the parent Job even though there is an error when executing the child Job) in tRunjob component.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: catch exception

Hi,

You can add twarn component at OnCompoentError of the component(Where you want to catch exception). Aslo checked Error on die check box.Add tlogCatcher in the job. You can select error in twarn using global variable. tWarn throws exception. LogCatcher catches the exception and you can see it by using tlog after it.
Also can find errors - Go to File. Edit project properties
- Change Job setting
- stat & logs
- save the log into DB
Use which one you want.
Cheers,
Sanjay