Page 1 of 1

Execute command activity and Exception Handler

Posted: Fri Aug 17, 2012 1:18 am
by djbarham
In a sequence job, I have "Automatically handle activities that fail" enabled and a generic exception handler that calls a routine to log a message and generate an email.

One of the steps is an Execute Command activity.

This shell command returns 0 on success, 1 if it didn't find the file (on a remote FTP server) it was looking for or other values if something broke (eg it couldn't connect to the FTP server). The script uses rsh to execute FTP on another server (due to firewall restrictions).

My issue is this ... the generated code for the exception handler always checks the result FIRST, before any trigger code. Although it reports the error as an unhandled exception, it ignores my attempts to handle it.

I have found the only way to stop the exception handler from intervening (apart from completely disabling it) is to use the "Otherwise" trigger.

It does not make sense to my why the triggers are not evaluated before the exception handler steps in.

The next best solution I can see is to have triggers for the 0 and 1 return values and then an "Otherwise" that goes to a routine activity that duplicates the one in the exception handler.

Anyone have any other thoughts about why it behaves this way or a better way to approach this?

Posted: Fri Aug 17, 2012 1:45 am
by BI-RMA
The exception handler does not evaluate the result of any command- or job activities being called by a sequence. It will identify errors like jobs not being in a runnable state and handle those. The result of the activities has to be evaluated using triggers - as you already found out.

Posted: Fri Aug 17, 2012 3:41 am
by ray.wurlod
If you have an explicit Failure trigger it should pre-empt anything the Exception Handler might be set up to do. A Failure trigger should fire if the exit status is any non-zero value.