Execute command activity and Exception Handler
Posted: Fri Aug 17, 2012 1:18 am
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?
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?