Uploaded image for project: 'Drivers'
  1. Drivers
  2. DRIVERS-2385

Provide access to raw result document when the server returns an error for a command

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Component/s: None
    • None
    • Needed
    • Hide

      Introduces a new expectedError.errorResponse assertion for matching the full command response attached to an exception. Note that some drivers may need to skip tests for BulkWriteException and WriteException.

      Drivers should sync unified tests for Collection Management, CRUD, and Unified Test Runner ("valid") with c04f2ec.

      Show
      Introduces a new expectedError.errorResponse assertion for matching the full command response attached to an exception. Note that some drivers may need to skip tests for BulkWriteException and WriteException. Drivers should sync unified tests for Collection Management, CRUD, and Unified Test Runner ("valid") with c04f2ec .
    • $i18n.getText("admin.common.words.hide")
      Key Status/Resolution FixVersion
      CDRIVER-4425 Fixed 1.24.0
      CXX-2543 Backlog
      CSHARP-4250 Backlog
      GODRIVER-2487 Done 1.11.0
      JAVA-4676 Fixed 4.8.0
      NODE-4404 Fixed 6.5.0
      MOTOR-992 Duplicate
      PYTHON-3351 Fixed 4.4
      PHPLIB-909 Fixed 1.15.0
      RUBY-3049 Fixed 2.19.0
      RUST-1405 Backlog
      SWIFT-1599 Won't Do
      $i18n.getText("admin.common.words.show")
      #scriptField, #scriptField *{ border: 1px solid black; } #scriptField{ border-collapse: collapse; } #scriptField td { text-align: center; /* Center-align text in table cells */ } #scriptField td.key { text-align: left; /* Left-align text in the Key column */ } #scriptField a { text-decoration: none; /* Remove underlines from links */ border: none; /* Remove border from links */ } /* Add green background color to cells with FixVersion */ #scriptField td.hasFixVersion { background-color: #00FF00; /* Green color code */ } /* Center-align the first row headers */ #scriptField th { text-align: center; } Key Status/Resolution FixVersion CDRIVER-4425 Fixed 1.24.0 CXX-2543 Backlog CSHARP-4250 Backlog GODRIVER-2487 Done 1.11.0 JAVA-4676 Fixed 4.8.0 NODE-4404 Fixed 6.5.0 MOTOR-992 Duplicate PYTHON-3351 Fixed 4.4 PHPLIB-909 Fixed 1.15.0 RUBY-3049 Fixed 2.19.0 RUST-1405 Backlog SWIFT-1599 Won't Do

      Summary

      A number of drivers use concrete types to model error responses from the server. As a result, when the server adds a new field to the error response for a command, users cannot actually see the new information.

      Rather than having drivers try to exhaustively model every possible field, this ticket proposes that to alleviate issues of missing error information, all drivers must somehow expose the full response document from the server when there is an error. This will future-proof us for cases where more information is added to any error responses in the future. The exact API for this will be up to each driver given the variety of error APIs we have across languages.

      There is not a natural place to specify this behavior, but to ensure the requirement is captured somewhere in case e.g. we write a driver in a new language, we also would like to add spec tests for this behavior. This may require an addition to the unified test format to support asserting on the response document.

      Motivation

      Who is the affected end user?

      All driver users.

      How does this affect the end user?

      The end user is not always able to get access to all of the information the server returns when a command fails.

      How likely is it that this problem or use case will occur?

      The only known instance of this problem right now occurs with the response to the collMod command, where errors can now have a violations property. This is discussed on DRIVERS-2353. However, the server may add more fields like this to command responses in the future, increasing the likelihood of users running into this.

      If the problem does occur, what are the consequences and how severe are they?

      Since the user is missing information it is hard/impossible for them to understand the error and take action on it.

      Is this issue urgent?

      The collMod change above was released in v5.2 of the server so users may already be running into this.

      Is this ticket required by a downstream team?

      Yes, this prevents mongosh from providing equivalent information in error responses to that the legacy shell provided. See MONGOSH-1250.

      Is this ticket only for tests?

      No, this ticket includes functional changes. That said, for some drivers such as Python that already expose the error response this will be a test-only change.

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            kaitlin.mahar@mongodb.com Kaitlin Mahar
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: