Created
January 18, 2015 14:32
-
-
Save manboubird/64aaf6b42529b59ae8a5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -o pipefail # Trace errors through pipes | |
set -o errtrace # Trace ERR through 'time command' | |
error() { | |
JOB="$0" # job name | |
LASTLINE="$1" # line of error occurrence | |
LASTERR="$2" # error code | |
echo "ERROR in ${JOB}:line ${LASTLINE} - exit code ${LASTERR}" | |
exit 1 | |
} | |
trap 'error ${LINENO} ${$?}' ERR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment