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

GODRIVER-2721 Fully support "errors.Is" and "errors.As". #1969

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

qingyang-hu
Copy link
Collaborator

@qingyang-hu qingyang-hu commented Mar 3, 2025

GODRIVER-2721

Summary

This PR draft is not meant to be merged.

This PR and #1984 replace error assertions (except those in replaceErrors() in "mongo\errors.go") with errors.Is() and errors.As().

However, the error assertion checks the immediate error type. Instead, errors.Is()/errors.As() trace the error tree. The difference changes the current error handling logic so they are not proper. Moreover, any further replacements in replaceErrors() will cause regression failures because of the logic change. The difference changes the error handling logic so any further replacements in replaceErrors() will cause regression failures. replaceErrors() will be replaced in another PR.

In conclusion, we should not replace error assertions with errors.Is()/errors.As() in the current code base.

We can consider closing GODRIVER-2721 and GODRIVER-2975, or making GODRIVER-2721 an epic for tickets such as GODRIVER-1854 and GODRIVER-2704.

Background & Motivation

Copy link
Contributor

API Change Report

No changes found!

@mongodb-drivers-pr-bot mongodb-drivers-pr-bot bot added the priority-3-low Low Priority PR for Review label Mar 4, 2025
@matthewdale matthewdale self-requested a review March 4, 2025 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority-3-low Low Priority PR for Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant