ExportXMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: Error
    • 1
    • Not Needed
    • None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      As a Node driver engineer,
      I want to store error information in exactly one place,
      So that we don't need to be responsible for maintaining the server information in two places.

      The server's actual error is stored both as the errorResponse field on the MongoServerError and has every property copied onto the server error (see https://github.com/mongodb/node-mongodb-native/blob/8ab5d19bee52bf1f0bc24a76586375a4825190f9/src/error.ts#L226).

      Why this needs a major

      Typed error responses are blocked by this. Connection.command can type any ok:1 response via responseType, but MongoServerError carries [key: string]: any, which cannot be narrowed while the copy loop exists. See Neal's comment on NODE-7779.

      User impact

      Removes top-level access to every server error field: err.keyPattern, err.keyValue, err.codeName, err.writeErrors. Migration is err.errorResponse.<field>, which is the spec-mandated path and works today.

      Unknowns

      n/a

      Acceptance Criteria

      Implementation Requirements

      • Remove the logic that copies keys from the server error onto the MongoServerError and instead only provide the errorResponse field.
      • Decide the fate of codeName, writeConcernError, errInfo and ok - these are declared on the class but assigned only by the copy loop, so they become undefined unless explicitly reassigned or removed from the declaration.

      Documentation Requirements

      • Remove API docs for MongoServerError enumerable keys

            Assignee:
            Unassigned
            Reporter:
            Aditi Khare (Inactive)
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: