Revision 9067
Added by Aaron Marcuse-Kubitza over 11 years ago
lib/sh/util.sh | ||
---|---|---|
57 | 57 |
# usage: cmd || die msg |
58 | 58 |
die () { save_e; echo "$1" >&2; rethrow; } |
59 | 59 |
|
60 |
# usage: cmd || { save_e; log_e; ...; rethrow; } |
|
61 |
log_e () { echo "! command exited with error $e" >&2; } |
|
62 |
|
|
63 | 60 |
# usage: try cmd...; ignore status; if catch status; then ...; fi; end_try |
64 | 61 |
|
65 | 62 |
function try () { e=0; "$@" || { export_e; true; }; } |
... | ... | |
150 | 147 |
|
151 | 148 |
log () { if can_log; then echo "$PS4$1" >&2; fi; } |
152 | 149 |
|
150 |
# usage: cmd || { save_e; log_e; ...; rethrow; } |
|
151 |
log_e () { echo "! command exited with error $e" >&2; } |
|
152 |
|
|
153 | 153 |
: "${log_indent= }" |
154 | 154 |
|
155 | 155 |
# usage: in func: inc_log_level; ... |
Also available in: Unified diff
lib/sh/util.sh: moved log_e () to verbose output section so it can use logging functions