Skip to content

Include underlying err.reason as err.cause for MongooseServerSelectionError #15416

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

Closed
2 tasks done
alexbevi opened this issue May 9, 2025 · 2 comments · Fixed by #15420
Closed
2 tasks done

Include underlying err.reason as err.cause for MongooseServerSelectionError #15416

alexbevi opened this issue May 9, 2025 · 2 comments · Fixed by #15420
Labels
enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature new feature This change adds new functionality, like a new method or class
Milestone

Comments

@alexbevi
Copy link
Contributor

alexbevi commented May 9, 2025

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the feature has not already been requested

🚀 Feature Proposal

The atlasMessage that overwrites the error message can make it difficult to actually troubleshoot certain errors.

Can we include the original err.reason as the Error.cause?

Motivation

No response

Example

No response

@alexbevi alexbevi added new feature This change adds new functionality, like a new method or class enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature labels May 9, 2025
@vkarpov15 vkarpov15 added this to the 8.14.3 milestone May 12, 2025
@vkarpov15 vkarpov15 modified the milestones: 8.14.3, 8.15 May 13, 2025
vkarpov15 added a commit that referenced this issue May 14, 2025
feat(error): set `cause` to MongoDB error `reason` on ServerSelection errors
@baileympearson
Copy link
Contributor

@vkarpov15 Thanks for merging this improvement quickly - would you be open to a PR that instead attaches the entire underlying error as the cause? Providing an error as the cause gives users the reason and the full stack trace to the underlying driver error.

@vkarpov15
Copy link
Collaborator

@baileympearson sure, feel free to put in that PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature new feature This change adds new functionality, like a new method or class
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants