Skip to content

Conversation

baileympearson
Copy link
Collaborator

@baileympearson baileympearson commented Sep 29, 2025

Description

Summary of Changes

This PR adds support for a custom error-wrapping function in the bindings. The function is used to wrap any error that is thrown from the C++ bindings. This is accomplished by subclassing the classes exported from our C++ bindings with wrappers that try-catch any errors thrown from C++.

This PR has a corresponding driver PR that uses the error wrapper to wrap errors in a MongoCryptError.

Patch against driver: https://spruce.mongodb.com/version/68daedb19fc9d800072eb762/tasks?sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC

What is the motivation for this change?

Release Highlight

Double check the following

  • Lint is passing (npm run check:lint)
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: type(NODE-xxxx)[!]: description
    • Example: feat(NODE-1234)!: rewriting everything in coffeescript
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@baileympearson baileympearson marked this pull request as ready for review September 30, 2025 16:51
@baileympearson baileympearson requested a review from a team as a code owner September 30, 2025 16:51
@durran durran self-assigned this Sep 30, 2025
@durran durran added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Sep 30, 2025
readonly kmsProvider: string;
readonly endpoint: string;
readonly message: Buffer;
addMongoOperationResponse(response: Uint8Array): void {
Copy link
Member

Choose a reason for hiding this comment

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

Just a note from our conversations, we discussed potentially drying this up by passing a bound function to the provided error wrapper and the try catch happening there, but were worried about the potential performance implications having to bind this outside of module load time.

@durran durran merged commit 7f0be63 into mongodb-js:main Sep 30, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Primary Review In Review with primary reviewer, not yet ready for team's eyes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants