[GODRIVER-2603] Use errors API from Go 1.13 Created: 24/Oct/22  Updated: 29/Jan/24  Resolved: 29/Jan/24

Status: Closed
Project: Go Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0.0, 1.14.0

Type: Task Priority: Minor - P4
Reporter: Benji Rewis (Inactive) Assignee: Preston Vasquez
Resolution: Fixed Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Gantt Dependency
has to be done before GODRIVER-2156 Enable all remaining golangci-lint li... Closed
has to be done after GODRIVER-2174 Bump the minimum Go version to 1.13 Closed
Related
related to GODRIVER-2646 Enable the "errlint" golangci-lint li... Backlog
related to GODRIVER-2721 Fully support "errors.Is" and "errors... Backlog
related to GODRIVER-2623 Use a clone of the http.DefaultTransp... Closed
Scoping
scopes GODRIVER-2952 Update context.Canceled equality comp... Closed
Backwards Compatibility: Fully Compatible
Documentation Changes: Not Needed
Documentation Changes Summary:

1. What would you like to communicate to the user about this feature?
2. Would you like the user to see examples of the syntax and/or executable code and its output?
3. Which versions of the driver/connector does this apply to?


 Description   

Now that we've bumped to Go version 1.13, we can make use of its features (particularly the added error API).

  1. Remove as much of internal/error.go as possible.
  2. When creating wrapped errors throughout the driver, use the new formatting directive %w where internal.WrappedError was used before.
  3. When examining wrapped errors in errors.go files, use errors.Is and errors.As instead of casting to "unwrappable" interfaces.
  4. Enable the errorlint linter and fix all errors.


 Comments   
Comment by Githook User [ 12/Dec/23 ]

Author:

{'name': 'Lokesh Kumar', 'email': 'lkumar94@gmail.com', 'username': 'kumarlokesh'}

Message: GODRIVER-2603 (Contd.) Revised error handling using Go 1.13 error APIs (#1488)
Branch: v1
https://github.com/mongodb/mongo-go-driver/commit/4dbe540c2b8656635cdc910391a91b5368888acc

Comment by Githook User [ 30/Nov/23 ]

Author:

{'name': 'Steven Silvester', 'email': 'steven.silvester@ieee.org', 'username': 'blink1073'}

Message: GODRIVER-2603 [master] (Contd.) Revised error handling using Go 1.13 error APIs (#1484)

Co-authored-by: Lokesh Kumar <lkumar94@gmail.com>
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/c0852202b3b6a0f6bdc48f35d95bce02020c5ce2

Comment by Githook User [ 20/Nov/23 ]

Author:

{'name': 'Steven Silvester', 'email': 'steven.silvester@ieee.org', 'username': 'blink1073'}

Message: GODRIVER-2603 [master] - Revised error handling using Go 1.13 error APIs (#1474)

Co-authored-by: Lokesh Kumar <lkumar94@gmail.com>
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/d33301f67192b59af97f492571ed1629e5cc0e23

Comment by Githook User [ 08/Sep/23 ]

Author:

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

Message: GODRIVER-2603 Use errors.Is/As for IsTimeout and IsDuplicateKeyError. (#1371)
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/b191b72002985fe8c4f7a8bbcbc9c3a56472b175

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