Skip to content

The failure from Unwrapping an "Err" does not tell you what error it was #13379

Closed
@wackywendell

Description

@wackywendell

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 anErr 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions