Add error_message function
This commit is contained in:
parent
8679335f19
commit
14c06c8b87
18
qb
18
qb
|
@ -69,6 +69,17 @@ debug_message() { # {{{
|
|||
return 0
|
||||
}
|
||||
# }}}
|
||||
error_message() { # {{{
|
||||
|
||||
local_error_message="${1}"
|
||||
local_error_code="${2}"
|
||||
|
||||
## Print message if DEBUG is enable (=0)
|
||||
[ "${DEBUG}" -eq "0" ] && printf '%b\n' "ERROR − ${PROGNAME} : ${RED}${local_error_message}${RESET}"
|
||||
|
||||
exit "${local_error_code:=66}"
|
||||
}
|
||||
# }}}
|
||||
is_proc_running() { # {{{
|
||||
|
||||
local_proc_pattern="${1}"
|
||||
|
@ -212,12 +223,9 @@ main() { # {{{
|
|||
define_vars
|
||||
|
||||
## Try to get a working qutebrowser binary
|
||||
### Or exit with error
|
||||
### Or exit with error message and code 1
|
||||
get_qutebrowser_bin \
|
||||
|| debug_message "main − \
|
||||
Can't find a working qutebrowser binary." \
|
||||
|| exit 2
|
||||
|
||||
|| error_message "Can't find a working qutebrowser binary." "1"
|
||||
|
||||
## If nothing related to Qutebrowser is currently running
|
||||
### Try to start qutebrowser
|
||||
|
|
Loading…
Reference in New Issue