One Star

[resolved] Capturing tSalesforceOutput and tRSSInput errors

Hello all,
I would like to capture any errors from the above components and email them. I have followed the instructions here: http://www.talendforge.org/forum/viewtopic.php?id=5992 on using tJavaRow and a variable "context.errormsg=input_row.message;" to capture the error and put it into an email.
Only prob is the variable context.errormsg keeps on coming out Null when there has been an issue. Am I looking in the wrong place for the error test?
thanks!
tim
1 ACCEPTED SOLUTION

Accepted Solutions
Community Manager

Re: [resolved] Capturing tSalesforceOutput and tRSSInput errors

Hello
Currently, we can't catch the whole error trace, some users have added a 9680. We will try to enhance the ability of error manage.
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
10 REPLIES
Community Manager

Re: [resolved] Capturing tSalesforceOutput and tRSSInput errors

Hello
First, what's the error message? It is a java exception? the tLogCatcher is used to catch the java exception, tDie and tWarn message. If the error is not a java exception, you could add a tDie to die the job and log a error message.
Second, modify a little on your job,
tRssInput---tMap-->...
|
onsubjoberror
|
tSendEmail
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] Capturing tSalesforceOutput and tRSSInput errors

Hi shong,
Thanks for your reply!
Difficult to say what error im catching as im not sure what errors could happen Smiley Happy The errors im testing with for tRSSInput is using the wrong URL and tSalesforceOutput invalid login details. What i need to be informed of is if the job has had an issue grabbing an item from the RSS feed or had an issue inserting it into Salesforce and email me the error reported.
Also I would like to do a check to make sure the number of RSS articles read is the same number of records inserted into Salesforce.
I do not want the job to completely die if an error is encountered, as it maybe just one record having a problem out of many, would tDie be the best approach?
Using onsubjoberror - does this mean that on any error on the job and email would be sent?
thanks for your help,
tim
Community Manager

Re: [resolved] Capturing tSalesforceOutput and tRSSInput errors

Hello
would tDie be the best approach?

If you don't want to die the job when an error occurs, you can use a tWarn just to warn a error message without die the job, and tLogCatcher will catch this error message.
Using onsubjoberror - does this mean that on any error on the job and email would be sent

Yes, any error on the previou sub job, maybe on tRssInput or tSaleOutput, a email would be sent.
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] Capturing tSalesforceOutput and tRSSInput errors

Hi shong, thanks again for your reply.
So thats logical to use tWarn as tSaleOutput is set to not Die on error.
I still have two issues...
tWarn is correctly triggered on job error and sends the email - but, all I get in the email is "this is a warning" what is the default messages from tWarn, not what has gone wrong. JavaRow code is "context.errormsg=input_row.message;" and SendMail message is "context.errormsg"
tSaleOutput is set to not die on error, as we are aware there will be times when errors will come up and we do not wish to die the full job. But, I still need to capture these errors, with die off, no errors are reported.

Sorry if this seems like simple issues, but I have struggled to find any help on this subject, if you can point me towards some documentation Ill happily have a look.
Have attached a screen grab of the project as well.
thanks, tim
Community Manager

Re: [resolved] Capturing tSalesforceOutput and tRSSInput errors

Hello Tim
Only prob is the variable context.errormsg keeps on coming out Null when there has been an issue

Yes, you are right. It will be null if you put all the components in a job, as the tLogCatcher component always catch the error message at the end of job. I have made a mistake, sorry.
Here we need move the components which will throw errors and the tLogCatcher component to another job. I have redesign the job, please see my screenshots.
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] Capturing tSalesforceOutput and tRSSInput errors

Hello shong, sorry for my delayed reply...
I have set things as above, but, when having an error with tRSS... or tSalesforce... I receive no emails.
I have made to changes to what you suggest...
1. Changed tRunJob output from OnSubjobOK to OnSubjobError
2. tSendMail "Die if the attachment file doesnt exist" = false
With the above changes I do get an email, but, the body in the email is "null" Smiley Sad
Please let me know what you think? If I can provide you with anymore info please say.
thanks,
tim
Community Manager

Re: [resolved] Capturing tSalesforceOutput and tRSSInput errors

Hello tim
I tested and it is fine, not null. So can you export your job and send it to me via email?
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] Capturing tSalesforceOutput and tRSSInput errors

Hi Shong,
Not sure what I missed but it is working correctly now, maybe I miss spelled one of the variables.
If i put in a wrong RSS url I get an error "java.lang.NullPointerException:null" - what's a good start!
But, in talend studio I have this reported in the Rub Job tab...
"org.dom4j.DocumentException: Server returned HTTP response code: 403 for URL: ...(rest removed)"
This is a more useful error for me, is there anyway to capture this?
Thanks for your help!
tim
Community Manager

Re: [resolved] Capturing tSalesforceOutput and tRSSInput errors

Hello
Currently, we can't catch the whole error trace, some users have added a 9680. We will try to enhance the ability of error manage.
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] Capturing tSalesforceOutput and tRSSInput errors

thank you so much for your help shong!
tim