by iand · 10y ago · 0 comments
a, err := foo()
if err != nil {
return nil, fmt.Errorf("failed to foo: %v", err)
} foo().map_err(MyError::new)?`Error() string` is just the interface that things that want to be errors must implement, which ideally gives you the human readable version of the error.
let a = foo().chain_err(|| "failed to foo")?;