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 · 3 comments
Open

database/sql: error not wrapped #44635

eduardisimo203 opened this issue Feb 26, 2021 · 3 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@eduardisimo203
Copy link

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
Member

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?

@seankhliao seankhliao added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Feb 26, 2021
@ianlancetaylor ianlancetaylor changed the title sql: error not wrapped database/sql: error not wrapped Feb 26, 2021
@eduardisimo203
Copy link
Author

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.

@seankhliao seankhliao added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Feb 26, 2021
@gopherbot
Copy link

Change https://golang.org/cl/333990 mentions this issue: database/sql: explicitly wrap error message in convertAssignRows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants