diff --git a/qb b/qb index 6b57738..69c6c90 100755 --- a/qb +++ b/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