[GODRIVER-2929] Improve error messaging by wrapping errors in Go Driver 1.x Created: 02/Aug/23  Updated: 09/Jan/24

Status: Backlog
Project: Go Driver
Component/s: Error Handling
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Unknown
Reporter: Matt Dale Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: rp-track
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to GODRIVER-2932 Timeout errors that occur while start... Backlog
related to GODRIVER-2941 Should we account for driver.WriteCom... Backlog
related to GODRIVER-3031 Errors on retryable ops should indica... Scheduled
is related to GODRIVER-2721 Fully support "errors.Is" and "errors... Backlog
is related to GODRIVER-2775 Remove the "replaceErrors" function Backlog

 Description   

There are a bunch of places we could improve information in errors returned by the Go driver by wrapping errors with additional context. In some cases we can't change errors because it would break backward compatibility (see GODRIVER-2721 for the related Go Driver 2.0 ticket), but in many cases we can wrap errors.

Definition of done:

  • Audit errors returned by the Go Driver to find ones that we can change (i.e. we don't promise to return a specific error value) and that we can wrap with additional information.
    • Consider using the errrolint linter to check for misuse of the Go 1.13 error wrapping pattern.
  • Replace all uses of the internal errutil.WrapErrorf with fmt.Errorf using the "%w" verb.
  • Consider copying the Go stdlib errors.Join code into the errutil package to support multi-errors.


 Comments   
Comment by Githook User [ 04/Nov/23 ]

Author:

{'name': 'Matt Dale', 'email': '9760375+matthewdale@users.noreply.github.com', 'username': 'matthewdale'}

Message: GODRIVER-2929 Add the ability to join multiple errors into one. (#1370)
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/848b7c207401ed414270613e929381a654ad6a29

Comment by Githook User [ 18/Aug/23 ]

Author:

{'name': 'Matt Dale', 'email': '9760375+matthewdale@users.noreply.github.com', 'username': 'matthewdale'}

Message: GODRIVER-2929 Replace all uses of errutil.WrapErrorf with fmt.Errorf (#1354)
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/43962b82a22fc391fb3e9653cdd4e25769b8ce04

Comment by Githook User [ 17/Aug/23 ]

Author:

{'name': 'Matt Dale', 'email': '9760375+matthewdale@users.noreply.github.com', 'username': 'matthewdale'}

Message: GODRIVER-2929 Make driver.ErrDeadlineWouldBeExceeded wrap context.DeadlineExceeded (#1355)
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/e2c90c96e8ad6c7b7095c32be0e45e1216c77093

Generated at Thu Feb 08 08:39:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.