Skip to content
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

fix(connection): avoid unhandled error on createConnection() if on('error') handler registered #14390

Merged
merged 1 commit into from Mar 1, 2024

Conversation

vkarpov15
Copy link
Collaborator

Fix #14377

Summary

connection.on('error', fn) should mean that openUri() errors shouldn't count as unhandled exceptions.

Examples

@vkarpov15 vkarpov15 added this to the 8.2.1 milestone Feb 28, 2024
@wuuv
Copy link

wuuv commented Feb 28, 2024

Hi, why u not try handle errors when use await client.connect(); here:

something like: try { await client.connect(); } catch (err) { this.readyState = STATES.disconnected; this.emit('error', err); return this; }

Copy link
Collaborator

@hasezoey hasezoey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@vkarpov15 vkarpov15 merged commit ec6a999 into master Mar 1, 2024
33 of 34 checks passed
@hasezoey hasezoey deleted the vkarpov15/gh-14377 branch March 1, 2024 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MongoNetworkTimeoutError crashes nodejs process
3 participants