[GODRIVER-2615] Implement Is and As for mongo errors Created: 26/Oct/22 Updated: 07/Nov/22 |
|
| Status: | Backlog |
| Project: | Go Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Benji Rewis (Inactive) | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
Came up in a recent slack conversation. We should implement Is or As for our custom errors to return true if any of the contained errors match the given error. Other popular drivers seem to follow this pattern to allow users to call errors.Is and errors.As on their custom errors. For each error in mongo/errors.go, implement Is to check all possible contained error strings and implement As to cast to any contained error type. |