Five Stars

[resolved] tsendmail give error arguments from job in message field

Hello erverybody,
How i can give tsendmail the error message with which comes from my Job when an error occurs into the message Field.
Are there any preconfigured args ?
regards john 
16 REPLIES
Six Stars

Re: [resolved] tsendmail give error arguments from job in message field

Hy,
Before your tSendMail, use a tLogCatcher to catch errors (java, tDie & tWarn).
And, in your tSendMail, print the message from the tLogCatcher.
Arnaud
Five Stars

Re: [resolved] tsendmail give error arguments from job in message field

Hello Arnaud,
My Job is builded in this way which you've mentioned before already.
But it seems that only an connect with the tLogCatcher component isn't enough. The message from the incoming mail doesn't show any errors. 
So may  i have to set some Settings or Arguments  ?
regards john 
Six Stars

Re: [resolved] tsendmail give error arguments from job in message field

Verify, on tLogCatcher, all checkboxes are checked. If the error don't catch, you must modify your job to generate an error with a tDie ou a tWarn.
Do you have a screenshot of your job please ?
Moderator

Re: [resolved] tsendmail give error arguments from job in message field

Hi,
You can use OnComponentError to connect tDie.
The workflow should be:
tfileinput----->tfileoutput -----OnComponentError---> tDie
tLogCatcher ---main---> tSendMail
Don't forget to check the 'die on error' option so that the job will stop once an error occurs.
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.
Five Stars

Re: [resolved] tsendmail give error arguments from job in message field

Hello 
First of all
 Thanks for Helping 
So now .. my Job looks like this :
I have added the Tdie Component which has Sabrinia already mentioned.
Here my Tsendmail Settings:
Here the tlog catcher settings:
And here is the Message which comes to the MailInbox:

regards john 
Six Stars

Re: [resolved] tsendmail give error arguments from job in message field

Great, please, could you mark this topic as resolved ?
Arnaud
Five Stars

Re: [resolved] tsendmail give error arguments from job in message field

Hello Arnauld
Why resolved ?
I want to get an error message in the mail from my job.
But there is no error message in the Email.
Do i overlook sth. ?
regards john 
Moderator

Re: [resolved] tsendmail give error arguments from job in message field

Hi,
You got your email without any error message in it? Did you pass the error message to tSendMail message body?
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.
Six Stars

Re: [resolved] tsendmail give error arguments from job in message field

Sorry ;-)
In your tSendMail, you can use data from tLogCatcher : see your row2 schema.
For example, you can write in your tSendMail message : 
"Hello,
There is a problem.
Job " + row2.job + "
"+row2.moment+"
"+row2.project+" ("+row2.context+") / "+row2.origin+"
"+row2.type+" : "+row2.message+" ("+row2.code+")
Good Luck."
Five Stars

Re: [resolved] tsendmail give error arguments from job in message field

Hello you two,
@Arnaud:
Your code works perfect.  Thanks for that
Does any Table exist with some preconfigured Arguments which is mentioned in your code Solution?  
@Sabrina:
Your code doesn't work in my environment ... may I'm doing it wrong.
I have tried two ways:
1. "Here is the error Message:  ((String)globalMap.get ("tLogCatcher_1_ERROR_MESSAGE"))"|
2."Here is the error Message:  ((String)globalMap.get ("tLogCatcher_1_ERROR_MESSAGE"))"
There comes an error :
1. 
2. 

 regards john 
Moderator

Re: [resolved] tsendmail give error arguments from job in message field

Hi,
Please try this solution to see if it works
"The exception is:"+((String)globalMap.get("tLogCatcher_1_ERROR_MESSAGE"))

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.
Moderator

Re: [resolved] tsendmail give error arguments from job in message field

Hi,
Or you can use a tLogCatcher to capture  the exception and put it to a global variable or context variable for use later, and then send an email whenever an exception occurs.
For example:
tLogCatcher--main--tJavaRow
    |
onsubjobok
    |
tSendMail
on tJavaRow:
globalMap.put("errorMessage", input_row.message);
in the message field of tSendMail, get the exception message like:
"The exception is: "+((String)globalMap.get("errorMessage"))
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.
Six Stars

Re: [resolved] tsendmail give error arguments from job in message field

Hi,
Does any Table exist with some preconfigured Arguments which is mentioned in your code Solution?  

All arguments come from tLogCatcher component (see schema). But no table exist with some preconfigured arguments to put in your message.
Arnaud
Five Stars

Re: [resolved] tsendmail give error arguments from job in message field

 
@Sabrina:
Sorry my coding Abilities and Understanding for it  are not as high as you might think.  ; ) 
1. Your Second Code as youve  recommend looks like this in the Subject Line :  The exception is:null
2. So as far as I understood ... In your example  Solution i have to set an context variable to the component ( ex. tJavaRow) like this:
   
I think it is similar with the method which Arnaud pointed out with th exception that the context still exist based on the schema  and your method needs an extra context variable .. or ? 
Edit: Some added Text for explaination 
regards john 
Five Stars

Re: [resolved] tsendmail give error arguments from job in message field

Don't get me wrong .. the solutions are quite enough and sufficient for us ...
Thanks for that...
Neverthless I just want to understand the 2cnd Solution from Sabrina.
regards john
Five Stars

Re: [resolved] tsendmail give error arguments from job in message field

Hm seems that is a little bit difficult to understand .. what i wanted to know further 
But ... I think i can live very well with the solution from arnaud.
so thanks for helping guys  
regards john