From help set
and Bash Reference Documentation: The Set Builtin:
-e Exit immediately if a command exits with a non-zero status.
But it's considered bad practice by some (Bash FAQ and IRCFreenode #bash FAQ authors). It's recommended to use:
trap 'do_something' ERR
to run do_something
function when errors occur.
See Why doesn't set -e (or set -o errexit, or trap ERR) do what I expected?