On Sunday, May 1, 2022 at 11:17:35 AM UTC-4 axel.wa...@googlemail.com wrote:

> In the first case, you ask if the respective errors wrap e1. The answer is 
> yes - both wrap e1.
> In the second case, you ask if one error wraps the other. The answer is no 
> - they both wrap ErrInvalidArgument, but they don't wrap each other.
>

Are you talking about the following two checks?

if errors.Is(e2, e1)
if errors.Is(eGot, eExpected)

I see both are checking if the respective errors are wrapping (from) the 
same error.
 
Why one works and one doesn't?

errors.Is doesn't check if both errors passed wrap the same error - they 
> check if the first argument wraps the other.
>
> On Sun, May 1, 2022 at 4:56 PM Tong Sun <sunto...@gmail.com> wrote:
>
>> Please take a look at
>> https://go.dev/play/p/Dl_IGD46bPe
>>
>> I have two error wrappings there, one works and one doesn't (I'm 
>> expecting both to be the "Same"). Why one works and one doesn't?
>>
>> thanks
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/3a1c9ad1-8d7c-481a-bfbb-4d4c94cc8f72n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/golang-nuts/3a1c9ad1-8d7c-481a-bfbb-4d4c94cc8f72n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/47ceb9a6-8b4f-441b-b694-438ac8764c01n%40googlegroups.com.

Reply via email to