now in it's own repo, like it should be!

This commit is contained in:
2024-11-18 08:46:54 -06:00
parent 665b1b8d85
commit dcb40d94ab
12 changed files with 274 additions and 1 deletions

23
includes/error_out.sh Normal file
View File

@@ -0,0 +1,23 @@
#!/bin/bash
function error_out()
{
echo "Bailing out. See above for reason...."
exit 1
}
function handle_failure() {
local lineno=$1
local fn=$2
local exitstatus=$3
local msg=$4
local lineno_fns=${0% 0}
if [[ "$lineno_fns" != "-1" ]] ; then
lineno="${lineno} ${lineno_fns}"
fi
echo "${BASH_SOURCE[0]}: Function: ${fn} Line Number : [${lineno}] Failed with status ${exitstatus}: $msg"
}
trap 'handle_failure "${BASH_LINENO[*]}" "$LINENO" "${FUNCNAME[*]:-script}" "$?" "$BASH_COMMAND"' ERR