Overall, I'm in support of the suggestions being made in the draft discussions regarding inspection using the proposed Unwrap
method. They seem to generally be in line with what I'd expect from Go. I'm in favor of not including the errors.Last
for the reasons stated in the Open Questions and I think Unwrap
is a fitting name for that method.
However, I'm less comfortable with errors.Is
and errors.As
. I think they could be useful, particularly in the way they are demonstrated in the draft, but I'm more concerned as to the actual internal implementation. Given errors.Is
uses a perpetual for
loop to look through the chain and the if err == target { return true }
could evaluate to true
at any point along the chain, it would be unclear as to where exactly it found a match. The root error (or the first error) is typically the one that I'm most interested in as that was the initial source of the rest of the resulting chain. By adding in the for
loop that covers every part of the chain, handling c