mirror of
https://github.com/tteck/Proxmox.git
synced 2024-11-30 02:14:34 +01:00
Update paperless-ngx-v5-install.sh
add error_handler
This commit is contained in:
parent
bb63e91f32
commit
08efe35850
@ -14,21 +14,14 @@ CM="${GN}✓${CL}"
|
|||||||
CROSS="${RD}✗${CL}"
|
CROSS="${RD}✗${CL}"
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
set -o errexit
|
set -Eeuo pipefail
|
||||||
set -o errtrace
|
trap 'error_handler $LINENO "$BASH_COMMAND"' ERR
|
||||||
set -o nounset
|
function error_handler() {
|
||||||
set -o pipefail
|
local exit_code="$?"
|
||||||
shopt -s expand_aliases
|
local line_number="$1"
|
||||||
alias die='EXIT=$? LINE=$LINENO error_exit'
|
local command="$2"
|
||||||
trap die ERR
|
local error_message="${RD}[ERROR]${CL} in line ${RD}$line_number${CL}: exit code ${RD}$exit_code${CL}: while executing command ${YW}$command${CL}"
|
||||||
|
echo -e "\n$error_message\n"
|
||||||
function error_exit() {
|
|
||||||
trap - ERR
|
|
||||||
local reason="Unknown failure occurred."
|
|
||||||
local msg="${1:-$reason}"
|
|
||||||
local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE"
|
|
||||||
echo -e "$flag $msg" 1>&2
|
|
||||||
exit $EXIT
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function msg_info() {
|
function msg_info() {
|
||||||
|
Loading…
Reference in New Issue
Block a user