Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
manuel_toniato
Contributor
Contributor

cMap log level and exception handling

Hello!

I am trying to implement validation and exception handling on my route in the right way but I have some problems.

Here what I did (Talend Data Platform, 6.2.1):

  • I setted a validation inside a cMap component.
  • I setted the log level of the cMap component to "None" and Exception Threshold to "Error"
  • I put before the cMap a cTry and I connected the catch part to a cProcessor with the following code:
    Exception error = exchange.getProperty("CamelExceptionCaught", Exception.class);
    exchange.getOut().setHeaders(exchange.getIn().getHeaders());
    exchange.getOut().setHeader("ExceptionType",error.getClass().getCanonicalName());
    exchange.getOut().setHeader("ExceptionMessage",error.getMessage());
    exchange.getOut().setBody(exchange.getIn().getBody());

The problem is that in "ExceptionMessage" I don't see only the Errors (as I expected) but also a lot of Warnings before (85!!!!!).

Ex.

Exception Type: org.talend.transform.camel.TdmException
Exception Message: Overall: Error
1: Info - Executing map. (328) 
  Map: /TALEND_DQ_20180312_093614/Maps/Routes/Receipt/SNATT_2_UBL  Properties: {CamelFileName=SNATT_receipt_20180312084044899.xml, CamelFileNameProduced=/opt/Talend-6.2.1/backup/snatt/receipt/SNATT_receipt_20180312084044899.xml, SnattConfig=file:///opt/Talend-6.2.1/conf/snatt_config.json}

2: Warning - An element appeared in a JSON document that was not present in the structure. If this element is a JSON value, consider selecting the Name is Value element property.  (1401) 
  Enclosing [Map] Element : Map: Maps/Routes/Receipt/SNATT_2_UBL.xml - Map Element: in$/root/config/config/language_mapping
  countries

3: Warning - An element appeared in a JSON document that was not present in the structure. If this element is a JSON value, consider selecting the Name is Value element property.  (1401) 
  Enclosing [Map] Element : <none>
  country

[...]

83: Warning - An element appeared in a JSON document that was not present in the structure. If this element is a JSON value, consider selecting the Name is Value element property.  (1401) 
  Enclosing [Map] Element : <none>
  country

84: Warning - An element appeared in a JSON document that was not present in the structure. If this element is a JSON value, consider selecting the Name is Value element property.  (1401) 
  Enclosing [Map] Element : <none>
  language

85: Warning - An element appeared in a JSON document that was not present in the structure. If this element is a JSON value, consider selecting the Name is Value element property.  (1401) 
  Enclosing [Map] Element : Map: Maps/Routes/Receipt/SNATT_2_UBL.xml - Map Element: in$/root/config/config/language_mapping
  default

86: Error - A validation expression returned false. (305)  (INPUT) 
  Map: /TALEND_DQ_20180312_093614/Maps/Routes/Receipt/SNATT_2_UBL.xml - Map Element: in$/root/root/Header/Details/NumeroPO


In this way it is very difficult to recognize the exception.

Therefore I have two questions:

  1. I would like to know how to avoid all those warnings on my JSON input. I know that the file does not contain all the structure in all the elements... How can I tell the map to ignore this?
  2. Whether I manage to avoid the warnings, how can I set the exception handling of cMap component to show only errors and completely ignore warnings?

Thank you in advance.
Manuel

 

Labels (4)
3 Replies
Anonymous
Not applicable

Hello,

Are you able to use cOnException component to catch your errors in your route?

Could you please try to set the log level of the cMap component to "None" and Exception Threshold to "Fatal" to see if these info and warnings are printed on console?

Best regards

Sabrina

manuel_toniato
Contributor
Contributor
Author

Hello Sabrina,

 

thank you for you answer. Unfortunately the solution you provided didn't solve my problem.

I replaced the cTry with a cOnException structure, I set the Log Level and the Exception Threshold as you suggested but info and warnings are still there.

I also tried to modify the structure of the JSON part to get rid of all this warnings but every attempt was useless.

Any other suggestion? 

 

Thank you in advance,
Manuel

 

Anonymous
Not applicable

Hello,

With your Talend Data Platform, 6.2.1 subscription solution, could you please create a case on talend support portal so that our colleagues from support team will schedule a webex session to check your issue to see if it is a bug on V 6.2 through support cycle with priority?

Best regards

Sabrina