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

database/sql: error not wrapped #44635

Open
eduardisimo203 opened this issue Feb 26, 2021 · 2 comments
Open

database/sql: error not wrapped #44635

eduardisimo203 opened this issue Feb 26, 2021 · 2 comments

Comments

@eduardisimo203
Copy link

@eduardisimo203 eduardisimo203 commented Feb 26, 2021

What version of Go are you using (go version)?

$ go version
go version go1.16 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env

GOARCH="amd64"
GOHOSTOS="darwin"

What did you do?

Happened to use one of the SQL Exec methods and happened to get error at

return nil, fmt.Errorf("sql: converting argument %s type: %v", describeNamedValue(nv), err)

The error does not get wrapped (with "%w"), so cannot use errors.Is()

What did you expect to see?

What did you see instead?

@seankhliao seankhliao changed the title SQL error does not wrap an error sql: error not wrapped Feb 26, 2021
@seankhliao
Copy link
Contributor

@seankhliao seankhliao commented Feb 26, 2021

Which errors would this allow comparing to? And what would the calling code do differently when it can inspect the error?

@ianlancetaylor ianlancetaylor changed the title sql: error not wrapped database/sql: error not wrapped Feb 26, 2021
@eduardisimo203
Copy link
Author

@eduardisimo203 eduardisimo203 commented Feb 26, 2021

I believe the error is returned by our custom Scan(src interface{}) error method. And when we try to see if that error occurred, it, of course, fails because it's not wrapped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants