-
Notifications
You must be signed in to change notification settings - Fork 895
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-3163 Preserve original cancellation/timeout errors. #1625
GODRIVER-3163 Preserve original cancellation/timeout errors. #1625
Conversation
bcf62ef
to
7a3d47e
Compare
API Change ReportNo changes found! |
7a3d47e
to
e7bdf99
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! 👍
Note that there are no tests that assert this behavior, so it's possible there could be an undetected regression in this behavior. Since it's not a behavior we officially advertise, I think it's fine to wait and see if that becomes a problem.
@matthewdale should this be ported to |
@blink1073 Yes, it should. Thanks for checking! |
GODRIVER-3163
Summary
Previously transformNetworkError() would replace original errors with either
context.Canceled
orcontext.DeadlineExceeded
. This changes that so that the original error information is preserved.Background & Motivation
Use of
errors.Is()
implies a desire to honor wrapped errors. Replacing a wrapped error withcontext.Canceled
subverts that.This subversion adversely affects Mongosync, which wraps
context.Canceled
with detail about the cancellation’s cause. (See REP-3632 for details about this.)The same pattern applies to discarding the driver’s
originalError
in favor of DeadlineExceeded. We can safely preserve the originalnet.Error
’s context by wrapping DeadlineExceeded.