Use set -e/+e instead of exit_on_failed().