Add utility for calling trace_error() and exit()
This commit is contained in:
parent
5a4e6b4af6
commit
f1e7b40cc5
1 changed files with 9 additions and 0 deletions
|
@ -26,6 +26,15 @@ pub fn trace_error(e: &Error) {
|
|||
write!(stderr(), "\n").ok();
|
||||
}
|
||||
|
||||
/// Convenience function: calls `trace_error()` with `e` and afterwards `std::process::exit()`
|
||||
/// with `code`
|
||||
pub fn trace_error_exit(e: &Error, code: i32) {
|
||||
use std::process::exit;
|
||||
|
||||
trace_error(e);
|
||||
exit(code);
|
||||
}
|
||||
|
||||
/// Print an Error type and its cause recursively, but only `max` levels
|
||||
///
|
||||
/// Output is the same as for `trace_error()`, though there are only `max` levels printed.
|
||||
|
|
Loading…
Reference in a new issue