set -e looks like a safety net, but it has holes that surprise people.
set -e
check() { false; echo "still runs"; }
if check; then :; fi
When a function is used as the condition of if, while, && or ||, bash ignores set -e inside it. The code above prints still runs even though false failed. The same applies to commands before && and ||. For steps that must not fail, test them explicitly with cmd || exit 1.
Further reading: Bash manual: The Set Builtin