3 ms·
if err != nil { return nil, errors.Wrap(err, "bad stuff during foo") } looks pretty handy, I just want to tell the compiler to infer that everywhere by
by erik_seaberg 8y ago
if err != nil {
return nil, errors.Wrap(err, "bad stuff during foo")
}
looks pretty handy, I just want to tell the compiler to infer that everywhere by default, because writing it over and over is not only a waste of time but actively makes all code harder to read.
- jerf 8y agoThat's part of what's going into the new error proposal. (Although it's not going to be at the global level, but at the function level. "At the global level" becomes tricky if you try to actually spec it out; it's easy enough to just slap some designs down, but ones that compose well aren't so easy.)
- vram22 8y agoThat code seems somewhat like Python's chained exceptions.