From 99598aa60c11b19d205e90e49c49952574208be3 Mon Sep 17 00:00:00 2001 From: pvincent Date: Tue, 3 Aug 2021 18:17:03 +0400 Subject: [PATCH] trap any error --- src/main | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main b/src/main index db8a773..e30e959 100755 --- a/src/main +++ b/src/main @@ -3,6 +3,20 @@ ## FUNCTIONS ## --------- +function trap_error(){ + error_code=$1 + error_line=$2 + + printf "\nEXIT #${error_code} due to error at line ${error_line} : \n-----------------------------------------\n" + sed "${error_line}q;d" $0 + echo + exit $error_code +} + +set -e +trap 'trap_error $? $LINENO' ERR + + function runVoid(){ local COMMAND="$@" bash -c "${COMMAND}" >/dev/null 2>&1 @@ -225,6 +239,8 @@ for addon_id in "${!FIREFOX_ADDONS[@]}"; do fi done + + echo echo echo "# DEBIAN-GNOME successfully installed!"