Add 'die' function
Candidate replacement of multiple instances of the same error handling sequence.
This commit is contained in:
parent
14c467a764
commit
da20b17526
9
imgbb
9
imgbb
@ -62,6 +62,15 @@ print_usage() {
|
|||||||
echo " -h, --help Show this help message."
|
echo " -h, --help Show this help message."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
die() {
|
||||||
|
declare msg
|
||||||
|
|
||||||
|
msg="$*"
|
||||||
|
notify_cmd -u critical "ImgBB Upload Error" "$msg" &>/dev/null
|
||||||
|
echo "$msg" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
# Parse command-line options.
|
# Parse command-line options.
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
key="$1"
|
key="$1"
|
||||||
|
Loading…
Reference in New Issue
Block a user