function _defunc removed (#2199)

* function _defunc removed

* _shutdown is better than just notify in that cases

* PANIC_TYPE 'fail-init' introduced

Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
This commit is contained in:
Casper 2021-09-23 19:49:07 +02:00 committed by GitHub
parent 6715e0bba9
commit c7e9dd2bad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 36 additions and 44 deletions

View file

@ -21,13 +21,17 @@ function errex
# PANIC_SCOPE => Optionally provide a string for debugging to better identify/locate the source of the panic.
function dms_panic
{
local PANIC_TYPE=$1
local PANIC_INFO=$2
local PANIC_SCOPE=$3 #optional
local PANIC_TYPE=${1}
local PANIC_INFO=${2}
local PANIC_SCOPE=${3} #optional
local SHUTDOWN_MESSAGE
case "${PANIC_TYPE}" in
( 'fail-init' ) # PANIC_INFO == <name of service or process that failed to start / initialize>
SHUTDOWN_MESSAGE="Failed to start ${PANIC_INFO}!"
;;
( 'no-env' ) # PANIC_INFO == <ENV VAR name>
SHUTDOWN_MESSAGE="Environment Variable: ${PANIC_INFO} is not set!"
;;
@ -58,6 +62,7 @@ function dms_panic
}
# Convenience wrappers based on type:
function dms_panic__fail_init { dms_panic 'fail-init' "${1}" "${2}"; }
function dms_panic__no_env { dms_panic 'no-env' "${1}" "${2}"; }
function dms_panic__no_file { dms_panic 'no-file' "${1}" "${2}"; }
function dms_panic__misconfigured { dms_panic 'misconfigured' "${1}" "${2}"; }