Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Allow valid SRV hostnames with less than 3 parts #1525
base: main
Are you sure you want to change the base?
Allow valid SRV hostnames with less than 3 parts #1525
Changes from 1 commit
49ee4c4
1e918ad
2cb640e
540b89e
fb9feb5
8e10d43
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Does this (user-facing) error message discuss implementation details, for example the number of parts? The spec potentially suggests that this would be described as "...host name ... lacks a subdomain, and the resolved..."? I tried to compare against the other drivers, and I believe this corresponds to the following:
Node: https://github.com/mongodb/node-mongodb-native/pull/4197/files#diff-39b2554fd18da165b59a6351b1aafff3714e2a80c1435f2de9706355b4d32351R1181-R1185
Rust: https://github.com/mongodb/mongo-rust-driver/pull/1211/files#diff-32a39d356e1edde3d94581275b42e994ad1780ce4de8d6935ec5596fe4493ffdR39
However, I am not sure, because the error messages are different. It would have been useful if the spec specified the wording of the error messages.
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.
This exception is mainly for this prose testing case: mongodb/specifications@8e9d768#diff-dfcf948e6a987b880ea85e1907d5b7ce8fb98c9dab752f42ccdaf1e656b8848fR30
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.
thanks for referring to other driver's implementation. will investigate further.
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.
as per the following code snippet, the exception message won't be exposed to end user but end up with a generic exception:
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.
I changed the logic to accommodate the possibility that 'resolvedHost' could be something like
localhost
(as in Prosetest case No.3: mongodb/specifications@8e9d768#diff-dfcf948e6a987b880ea85e1907d5b7ce8fb98c9dab752f42ccdaf1e656b8848fR30) which doesn't contain '.' separator and so it has noparent domain
. After the code refactoring, no new exception or logic branch is required.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.
Were the prose tests passing previously? I thought you were testing against
localhost
.I believe all exception messages are exposed to the user. It may be in "caused by", but this is still visible.
I am not sure I follow the logic well enough to understand this - why is it that the other drivers have introduced 1 or 2 new messages, such as "Server record does not have at least one more domain level than parent URI", but we do not need to?
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.
yeah, you are totally correct in that the exception will be exposed to end user as exception's cause. I missed that. Now after new code change (converging the newly -added logic branch to the existing only flow), we reuse the old same exception mesage as below:
It is simply another way to express the same meaning, from my understanding. Maybe it is desirable to maintain backward compatibility so I didn't change it.