Handling errors
This scenario applies only to Talend Data Management Platform, Talend Big Data Platform, Talend Real Time Big Data Platform, Talend Data Services Platform, Talend MDM Platform and Talend Data Fabric.
For more technologies supported by Talend, see Talend components.
This following scenario creates a six-component Job that shows how to handle error conditions using the tHMap component.
When tHMap executes a Talend Data Mapper map, an ExecutionStatus object is always returned. A pointer to this object is stored in the globalMap as <tHMap_id>_EXECUTION_STATUS. In addition, the Overall Severity numeric value is also stored in the globalMap as <tHMap_id>_EXECUTION_SEVERITY.
Finally, a parameter called Exception Threshold is defined that specifies the severity on which to throw an exception, thus triggering Job-related or component-related error processing. This value can be defined in the tHMap properties, in the Advanced settings tab. The default value for this parameter is Fatal.
-
getOverallSeverity(): returns the numeric value of the highest
severity level.
- INFO is returned as 1
- WARN is returned as 2
- ERROR is returned as 4
- FATAL is returned as 0x40
- isOK(): returns true if there is no warning, error or fatal status.
- exportToXml(writer): writes the status items in XML format.