Throw MongoError subclasses from mongodb-client-encryption bindings

XMLWordPrintableJSON

    • None
    • None
    • None
    • None
    • None
    • None

      Use Case

      As a driver and FLE user,
      I want any errors thrown from the FLE bindings to be subclasses of MongoError,
      So that the driver's error hierarchy guarantees are upheld and I can determine if an error originated from the mongodb package.

      User Experience

      • Any FLE error thrown from the driver should be a MongoError.

      Dependencies

      • n/a

      Risks/Unknowns

      • There are a number of ways we could tackle this problem - two good options:
        • Wrap all mongocrypt APIs with try-catches in the driver.  Not as cumbersome as it sounds, there are only a few of these APIs.
        • Throw MongoErrors directly from our native bindings by registering a concrete error class (MongoError) with a mongocrypt. 

      Of the two above options, I'm partial to the second, primarily because it'd be a lot easier to test that we throw the correct error in our FLE bindings' unit tests than by trying to test the errors thrown from the bindings in the driver (native objects cannot be stubbed with sinon).

      Acceptance Criteria

      Implementation Requirements

      Testing Requirements

      • Ensure any error thrown from the FLE bindings in the driver is converted to a MongoError.

      Documentation Requirements

      • n/a

      Follow Up Requirements

      • n/a

              Assignee:
              Unassigned
              Reporter:
              Bailey Pearson
              None
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: