Revision 9072
Added by Aaron Marcuse-Kubitza over 11 years ago
lib/sh/util.sh | ||
---|---|---|
136 | 136 |
# usage: cmd || { save_e; log_e; ...; rethrow; } |
137 | 137 |
log_e () { log_err "command exited with error $e"; } |
138 | 138 |
|
139 |
# usage: cmd || die msg |
|
140 |
die () { save_e; echo "$1" >&2; rethrow; }
|
|
139 |
# usage: cmd || [type=...] die msg
|
|
140 |
die () { save_e; "log_${type:-err}" "$1"; rethrow; }
|
|
141 | 141 |
|
142 | 142 |
: "${log_indent= }" |
143 | 143 |
|
Also available in: Unified diff
lib/sh/util.sh: die (): allow caller to specify a custom log message type (i.e. a suffix for log_* ())