@mitsuhiko nice
there’s a lot of really great stuff in there, this improves the status quo a lot.
What do you think about allowing try! to propagate additional arguments, like I added in standard_error. This would allow this:
fn baz() -> EhResult<()> {
match bar() {
Err(err) => fail!(RecordNotFound, "could not find record", err),
Ok(x) => Ok(x),
}
}
to be rewritten as:
fn baz() -> EhResult<()> {
Ok(try!(bar(), RecordNotFound, "could not find record"))
}
Haven’t looked into how you implemented this, but it seems like that should be possible, right?
EDIT: this is extra useful where Result contains non-errors, like String.from_utf8.