Skip to main content Skip to complementary content

Using tDie, tWarn and tLogCatcher for error handling

This section explains how to design error handling with tDie, tWarn and tLogCatcher.

tDie allows you to have a code and message associated with the raised exception. It also has options to exit the JVM and kill the Job on exception. This component is very useful in case you want to take different actions in your Job based on the kind of error raised.

tWarn allows you to have a code and message associated with the raised exception. It is generally used to signal the completion of a Job or exceptions which do not block the execution of the Job. You can choose the message and the code you want to send to the catcher component. For example, you can use tWarn to signal the end of a specific pipeline flow in your Job.

tLogCatcher catches all exceptions and warnings raised by tWarn and tDie. You can also use tWarn or tDie at the end of the Job, to make tLogCatcher update the Job log when a Job finished successfully or to carry out other actions.

Sample Job

Sample Job in the design workspace.


In this example, the Job reads from a file, makes some changes and writes to an output file. tWarn is used to signal when the Job is completed successfully and is written to a file. tDie is used to capture any errors when writing the file, and the message is written to a file.

When the Job runs, there are three possible results.
  • The Job works as expected and the file is written successfully. In this case, tWarn displays the message and the Job exits green.
  • The Job works but there is an issue while creating the file. In this case, the Job does not end but displays an error and exits gracefully.
  • The Job meets a fatal error.

tLogCatcher catches all the errors and redirects them as per the conditions given in tMap. Here, all the warnings raised by tWarn are sent to a warning file, all the error messages raised by tDie are sent to an error file and all other unexpected errors are sent to another error file.

Depending on the requirement and design, these components can be used to control the Job and also effectively manage the data flow. For example, you can use tWarn to call on a subJob if the file is created successfully.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!