-
Notifications
You must be signed in to change notification settings - Fork 18k
database/sql: use %w verb for valuer errors to enable errors.Is/As #64707
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Edited your issue to add a code block. |
I don't think this can cause any issues, so feel free to send a CL. Thanks! |
Use fmt.Errorf's %w verb to wrap errors in driverArgsConnLocked, which allows for easier unwrapping and checking of error types. Add tests in sql_test.go to ensure that Stmt.Exec and Stmt.Query correctly wrap underlying Valuer errors, adhering to the new change. Fixes golang#64707.
Change https://go.dev/cl/550116 mentions this issue: |
Related issue #44635, and CL https://go-review.googlesource.com/c/go/+/333990 |
@mauri870 Can you help me review CL? https://go.dev/cl/550116 |
Use fmt.Errorf's %w verb to wrap errors in driverArgsConnLocked, which allows for easier unwrapping and checking of error types. Add tests in sql_test.go to ensure that Stmt.Exec and Stmt.Query correctly wrap underlying Valuer errors, adhering to the new change. Fixes golang#64707.
Use fmt.Errorf's %w verb to wrap errors in driverArgsConnLocked, which allows for easier unwrapping and checking of error types. Add tests in sql_test.go to ensure that Stmt.Exec and Stmt.Query correctly wrap underlying Valuer errors, adhering to the new change. Fixes golang#64707.
For golang#64707 For golang#65614 Signed-off-by: aimuz <mr.imuz@gmail.com>
Change https://go.dev/cl/568755 mentions this issue: |
For #64707. For #65614. Change-Id: Ib07ac67d7652bc7c9e1363f70637938c7bb4bc72 GitHub-Last-Rev: a4d8eca GitHub-Pull-Request: #66089 Reviewed-on: https://go-review.googlesource.com/c/go/+/568755 Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Go version
go version go1.21.4 darwin/arm64
What operating system and processor architecture are you using (
go env
)?What did you do?
What did you expect to see?
errors.Is
should be able to detect sentinel errors returned by valuer. error will need to be properly wrapped by fmt.Errorf with%w
verb instead of%v
, similar to scannerWhat did you see instead?
valuer errors are wrapped by fmt.Errorf with %v verb
The text was updated successfully, but these errors were encountered: