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.
feat(NODE-5484)!: mark MongoError for internal use and remove Node14 cause assignment logic #3800
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
feat(NODE-5484)!: mark MongoError for internal use and remove Node14 cause assignment logic #3800
Changes from 4 commits
a8653ba
d504317
d2012c5
ea5ea72
53491bd
55f487c
ccb0866
be7c2f9
85b02a5
4b1ad15
aac86bc
48f7e15
6618575
ae76093
1d08c4b
2a58338
12d8aa7
484519d
d8ee589
0838e97
7120ef7
414d53a
b51ad79
161d32b
564d117
aaa2ebe
4ca5acd
6511534
65c7767
4ec65c2
56920da
9d01de6
25ad3a4
b0d687a
2cfa31d
b818f3b
d24285b
c942e9f
7553a6d
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.
buildErrorMessage
relied on being passed the potential AggregateError, this change should result in some test failures.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.
Is this comment suggesting we fix the tests or that we revert the change?
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.
Either, I don't feel strongly. I don't see test failures which is intriguing, maybe because the tests are still just passing in an error as the first argument?
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.
What exactly is it that adding
@internal
is supposed to achieve? It won’t prevent users from creating class instances, it’s only going to make the class look like it doesn’t have its own constructor, i.e. uses theconstructor(...args) { super(...args); }
one.If you want to prevent users from creating instances of these classes, you may need to do something like
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.
We're doing this in an attempt to communicate that these classes shouldn't be instantiated by users. It's a pattern we have a lot elsewhere in the driver that probably could use some work with regards to getting that message across.
Wouldn't this solution also have the same effect? The user might not have documentation for the static
create
method, but they would still be able to call it on their end, right?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, I get the intention here, and I agree that it's a goal that's worth putting effort into. :)
The problem is specifically with marking constructors as
@internal
, which is different from all other methods, because that it does not make it appear to consumers of your .d.ts file that there is no publicly accessible constructor; instead, the TS definition effectively says that "the constructor of this class has the same signature as the constructor of the parent class".That's different with a static method; yeah, of course users could still call it by casting the class to
as any
or just not using TS validation at all, but at least it would not show up in the generated TS definitions.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.
Okay, I see what you're saying now. I'll check with the team to see if we want to start with that new pattern here or deal with it in a separate ticket that takes care of this across the driver. Thanks for the clarification!