-
Notifications
You must be signed in to change notification settings - Fork 893
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-3086 Add ErrorCodes to ServerError API #1894
base: master
Are you sure you want to change the base?
Conversation
API Change Report./v2/mongocompatible changesBulkWriteException.ErrorCodes: added |
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.
Thank you for this! :)
@@ -252,9 +252,23 @@ type ServerError interface { | |||
// HasErrorCodeWithMessage returns true if any of the contained errors have the specified code and message. | |||
HasErrorCodeWithMessage(int, string) bool | |||
|
|||
// ErrorCodes returns a deduplicated list of error codes returned by the | |||
// server. |
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’d be good to mention if there’s a defined sort order.
return hasErrorCode(e, code) | ||
} | ||
|
||
// ErrorCodes returns a list of error codes returned by the server. |
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’d be good to mention if there’s a defined sort order.
} | ||
return false | ||
|
||
// Deduplicate error codes. |
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.
Not that it affects us :), but: I see the same logic here and in WriteException’s method. This seems like the sort of thing you’d deduplicate.
GODRIVER-3086
Summary
Extend the
ServerError
interface to includeErrorCodes
which will return a list of deduplicated error codes returned by the server during the lifetime of operation execution.Background & Motivation
The Go Driver provides a way to check if a ServerError has a specific error code, but no way to determine all error codes that occurred during the operation.