Page 1 of 1

Return Code Variable for Native Command

Posted: Sun Aug 23, 2015 12:47 am
by kgould
If I set the Return Code Variable in a Native Command task and the task is set to call a module if the program errors I am seeing a value of 0 in the variable but the log is showing a return code of the number I passed back from the executable. Is this by design? To get the return code in the variable do I have to have the task not route to my error module (On Error), but test for a value other than 0 in the return code variable and then call my error module?

Thank you

Re: Return Code Variable for Native Command

Posted: Mon Aug 24, 2015 1:25 pm
by Support_Rick
Your best bet in this situation is to do just that ...

Test your return code (ie, you're defining an error, not the system) then execute accordingly.

Remember, the OnError will set based on there being an issue with the execution of the task. If you're telling it there's an error (based on some value or generated return code) and the task is still executing as designed, then the OnError wouldn't trigger in this case.

Immediately following the exec task, put a condition to test the return value and then call the Error Module from there if indicated.