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.