Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gerror: compatibility standard library error , IIs interface not implemented #3635

Closed
wants to merge 2 commits into from

Conversation

junler
Copy link
Contributor

@junler junler commented Jun 7, 2024

Fixes #3633

if !ok {
e = Wrap(err, "").(IIs)
}
return e.Is(target)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是否这样改动更合适一些:

e, ok := err.(IIs)
if ok {
    return e.Is(target)
}
return err == target

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果改成这样,这个测试用例就过不了:t.Assert(gerror.Is(errors.New("1"), gerror.New("1")), true)

Copy link
Member

@gqcn gqcn Jun 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果改成这样,这个测试用例就过不了:t.Assert(gerror.Is(errors.New("1"), gerror.New("1")), true)

看了下,这个t.Assert(gerror.Is(errors.New("1"), gerror.New("1")), true)本来就不应该过。我新建了分支合并了你的提交新建了pr到这里 #3640 ,这个pr就可以关闭了。

@gqcn
Copy link
Member

gqcn commented Jun 12, 2024

#3640

@gqcn gqcn closed this Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

errors/gerror: The judgment result of gerror's Is() method is a bit counter-intuitive
2 participants