-
Notifications
You must be signed in to change notification settings - Fork 1.8k
refactor!(NODE-3368): make name prop on error classes read-only #2879
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
Conversation
…b/node-mongodb-native into NODE-3368/4.0/error-name-readonly
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.
Nice work! 🚀 just some suggestions we can discuss
Co-authored-by: Neal Beeken <[email protected]>
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.
LGTM
src/cmap/errors.ts
Outdated
this.address = pool.address; | ||
} | ||
|
||
get name(): string { | ||
return 'PoolClosedError'; |
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.
are the two renamings in this file intentional? these could potentially be breaking changes
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 was unintentional, but this did highlight another issue. The test should assert that the name
prop matches the actual name of the class, but this isn't true for PoolClosedError
and WaitQueueTimeoutError
as both of their name props add the "Mongo" prefix. For now, I've imported both of those errors and aliased them with their "Mongo" prefix, but it's only a temporary fix to a potentially larger problem.
Description
.name
property to ensure it is a read-only and matches the class name