A script that dies with no message costs me more time than any bug in it.
set -Eeuo pipefail
trap 'echo "failed at line $LINENO: $BASH_COMMAND" >&2' ERR
The ERR trap runs when a command fails. $LINENO is the line and $BASH_COMMAND is the command that was running. -E makes functions and subshells inherit the trap, otherwise it only fires in the main script body. The trap does not fire for failures that if or && already handle. This is bash syntax, and zsh handles error traps differently.
Further reading: Bash manual: trap