1
Fork 0

Handle errors properly in rustbook.

Silently ignoring errors is :( so lets not silently ignore them. huon is
:) now.
This commit is contained in:
Huon Wilson 2015-01-09 20:25:45 +11:00
parent 4247a30bdd
commit 80fb5ca874
4 changed files with 20 additions and 22 deletions

View file

@ -54,7 +54,12 @@ fn main() {
Ok(_) => {
match subcmd.execute(&mut term) {
Ok(_) => (),
Err(_) => os::set_exit_status(-1),
Err(err) => {
term.err(&format!("error: {}", err.description())[]);
err.detail().map(|detail| {
term.err(&format!("detail: {}", detail)[]);
});
}
}
}
Err(err) => {