PublicInMotionGmbH / git-hooks

1 stars 1 forks source link

Consider handling of script errors #3

Open michalochman opened 6 years ago

michalochman commented 6 years ago

The scripts should have some basic error handling. I would suggest then to at least exit if any of the commands exited with non-zero status:

set -e

// ... script code here

More complex solution would be to use trap and execute predefined handle_errors function, like so:

trap 'handle_errors' ERR

handle_errors() {
    echo "whoops, something went wrong!"
}

// ... script code here
radzio commented 6 years ago

PRs are welcome :)