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-2489 createPipelineOptionsDoc: return err #1036
Conversation
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.
It's good that we can update non-idomatic error handlings.
Thank you, Preston!
mongo/change_stream.go
Outdated
csOptDoc := cs.createPipelineOptionsDoc() | ||
if cs.err != nil { | ||
csOptDoc, err := cs.createPipelineOptionsDoc() | ||
if err != nil { | ||
return cs.Err() |
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.
It's confusing to check an error and then return a different error. Update this to return err
(instead of cs.Err()
) if it's not nil.
mongo/change_stream.go
Outdated
if cs.err != nil { | ||
|
||
csDocTemp, err := cs.createPipelineOptionsDoc() | ||
if err != nil { | ||
return cs.err |
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.
Same as above: It's confusing to check an error and then return a different error. Update this to return err
(instead of cs.err
) if it's not nil.
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 👍
GODRIVER-2489
Update
createPipelineOptionsDoc
to returnerror
to shore up non-idomatic error handling in the the change stream operations.