By default any activity thats fails puts the workflow into a pending state to allow an admin to see what went wrong the workflow.
However, you can manually control what happens when an activity fails by setting the following items inside the activity's General tab
Continue after max restarts = true
Max restarts = 0
After this you can check if the activity fails, either by checking an exitCode, like your doing, or there is a check on the outbound transition "Execute if previous activity status is" to determine if the workflow should take a success path or failed path.