Closed
Description
Right now, if you call result.unwrap()
for a variable result
that is an Err
, the program fails but does not tell you what was in the Err
. For example:
fn main() {
let test_err : Result<(), ~str> = Err(~"no reason whatsoever.");
let _ = test_err.unwrap();
}
Output:
task '<main>' failed at 'called
Result::unwrap()on an
Err value', /build/rust-git/src/rust/src/libstd/result.rs:187
It would be convenient if failing on a Result<T, E : Show>
also displayed the error it was failing on, so, for example, you could call let value = result.unwrap()
in the main function of a program and know that it would tell you not only if an error occurred but also what that error was.
Metadata
Metadata
Assignees
Labels
No labels