Skip to content

Commit

Permalink
Fix and cleanup fatal errors
Browse files Browse the repository at this point in the history
Replace the (non-existing) `_exiterr` calls, and replace `error` & `exit` by `fatalerror`.

Fixes #25
  • Loading branch information
silkeh committed Apr 11, 2019
1 parent f21f489 commit 64df076
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pdns_api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ load_config() {

if [[ -n "${CONFIG_D:-}" ]]; then
if [[ ! -d "${CONFIG_D}" ]]; then
_exiterr "The path ${CONFIG_D} specified for CONFIG_D does not point to a directory."
fatalerror "The path ${CONFIG_D} specified for CONFIG_D does not point to a directory."
fi

# Allow globbing
Expand All @@ -113,7 +113,7 @@ load_config() {
# shellcheck disable=SC1090
. "${check_config_d}"
else
_exiterr "Specified additional config ${check_config_d} is not readable or not a file at all."
fatalerror "Specified additional config ${check_config_d} is not readable or not a file at all."
fi
done

Expand Down Expand Up @@ -176,8 +176,7 @@ request() {

# Abort on failed request
if [[ "${res}" = *"error"* ]] || [[ "${error}" = true ]]; then
error "API error: ${res}"
exit 1
fatalerror "API error: ${res}"
fi
}

Expand Down Expand Up @@ -359,8 +358,7 @@ exit_hook() {
if [[ -x "${PDNS_EXIT_HOOK}" ]]; then
exec "${PDNS_EXIT_HOOK}"
else
error "${PDNS_EXIT_HOOK} is not an executable"
exit 1
fatalerror "${PDNS_EXIT_HOOK} is not an executable"
fi
fi
}
Expand Down

0 comments on commit 64df076

Please sign in to comment.