Update build.func
This commit is contained in:
parent
6e6f5dafbc
commit
668d711af2
@ -65,10 +65,10 @@ color() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# This function enables error handling in the script by setting options and defining a trap for the ERR signal.
|
# This function enables error handling in the script by setting options and defining a trap for the ERR signal.
|
||||||
catch_errors() {
|
#catch_errors() {
|
||||||
set -Eeuo pipefail
|
# set -Eeuo pipefail
|
||||||
trap 'error_handler $LINENO "$BASH_COMMAND"' ERR
|
# trap 'error_handler $LINENO "$BASH_COMMAND"' ERR
|
||||||
}
|
#}
|
||||||
|
|
||||||
# This function is called when an error occurs. It receives the exit code, line number, and command that caused the error, and displays an error message.
|
# This function is called when an error occurs. It receives the exit code, line number, and command that caused the error, and displays an error message.
|
||||||
error_handler() {
|
error_handler() {
|
||||||
@ -76,12 +76,12 @@ error_handler() {
|
|||||||
if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID >/dev/null; then kill $SPINNER_PID >/dev/null; fi
|
if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID >/dev/null; then kill $SPINNER_PID >/dev/null; fi
|
||||||
printf "\e[?25h"
|
printf "\e[?25h"
|
||||||
local exit_code="$?"
|
local exit_code="$?"
|
||||||
local line_number="$1"
|
#local line_number="$1"
|
||||||
local command="$2"
|
#local command="$2"
|
||||||
local error_description="$(get_error_description "$exit_code")"
|
#local error_description="$(get_error_description "$exit_code")"
|
||||||
local error_message="${RD}[ERROR]${CL} in line ${RD}$line_number${CL}: exit code ${RD}$exit_code${CL} (${YW}$error_description${CL}): while executing command ${YW}$command${CL}"
|
#local error_message="${RD}[ERROR]${CL} in line ${RD}$line_number${CL}: exit code ${RD}$exit_code${CL} (${YW}$error_description${CL}): while executing command ${YW}$command${CL}"
|
||||||
#post_update_to_api "failed" "$exit_code" "$error_description"
|
#post_update_to_api "failed" "$exit_code" "$error_description"
|
||||||
echo -e "\n$error_message\n"
|
#echo -e "\n$error_message\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
# This function displays an informational message with logging support.
|
# This function displays an informational message with logging support.
|
||||||
@ -1589,7 +1589,8 @@ exit_script() {
|
|||||||
#post_update_to_api "failed" "$exit_code"
|
#post_update_to_api "failed" "$exit_code"
|
||||||
}
|
}
|
||||||
|
|
||||||
#trap 'exit_script' EXIT
|
#
|
||||||
|
trap 'exit_script' EXIT
|
||||||
#trap 'post_update_to_api "failed" "2"' ERR
|
#trap 'post_update_to_api "failed" "2"' ERR
|
||||||
#trap 'post_update_to_api "failed" "130"' SIGINT
|
#trap 'post_update_to_api "failed" "130"' SIGINT
|
||||||
#trap 'post_update_to_api "failed" "143"' SIGTERM
|
#trap 'post_update_to_api "failed" "143"' SIGTERM
|
||||||
|
Loading…
x
Reference in New Issue
Block a user