feat(log): Log parameter errors
This commit is contained in:
@@ -35,13 +35,19 @@ badParam() {
|
||||
if [ "$1" = "null" ]; then
|
||||
printf "\n%sERROR: '%s' cannot have a NULL (empty) value.\n" "$err" "$2"
|
||||
printf "%sPlease use '--help' for assistance.%s\n\n" "$cyan" "$norm"
|
||||
([ "$logToConsole" -eq 0 ]) && writePlainTextLog \
|
||||
"${2} cannot have a NULL (empty) value" "critical" "fail" "preexec" 1
|
||||
exit 1
|
||||
elif [ "$1" = "dne" ]; then
|
||||
printf "\n%sERROR: '%s %s'\n" "$err" "$2" "$3"
|
||||
printf "file or directory does not exist or is empty.%s\n\n" "$norm"
|
||||
([ "$logToConsole" -eq 0 ]) && writePlainTextLog \
|
||||
"${3}: file or directory does not exist or is empty" "critical" "fail" "preexec" 1
|
||||
exit 1
|
||||
elif [ "$1" = "errMsg" ]; then
|
||||
printf "\n%sERROR: %s%s\n\n" "$err" "$2" "$norm"
|
||||
([ "$logToConsole" -eq 0 ]) && writePlainTextLog \
|
||||
"$2" "critical" "fail" "preexec" 1
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
@@ -349,6 +355,8 @@ while [ $# -gt 0 ]; do
|
||||
*)
|
||||
printf "\n%sUnknown option: %s\n" "$err" "$1"
|
||||
printf "%sUse '--help' for valid options.%s\n\n" "$cyan" "$norm"
|
||||
([ "$logToConsole" -eq 0 ]) && writePlainTextLog \
|
||||
"Unknown script parameter: '${1}'" "critical" "fail" "preexec" 1
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user