Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-44466

Add "errorDocument" field to failCommand fail point

    • Type: Icon: New Feature New Feature
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • v4.4, v4.2
    • Service Arch 2020-04-06

      Drivers use the failCommand fail point extensively in spec tests. It seems that with each server release we need to add a new knob to this fail point in order to test new features. In 4.0 we added the "writeConcernError" field (SERVER-35083). In 4.4 we're adding the "errorLabels" field (SERVER-43941).

      It might be useful to add a way for the command to specify the entire error document to return instead of just the error code or the errorLabels. For example:

      db.adminCommand({
          configureFailPoint: "failCommand",
          mode: "alwaysOn",
          data: {failCommands: ["find"], errorDoc: {ok: 0, code: 2, errmsg: "my error message", errorLabels: ["Label"]}}
      });
      // Returns {ok: 0, code: 2, errmsg: "my error message", errorLabels: ["Label"]}
      db.runCommand({find: "collection"});
      db.adminCommand({configureFailPoint: "failCommand", mode: "off"});
      

      This would also satisfy SERVER-42239 since the user could add "extraInfo" to the errorDoc.

            Assignee:
            spencer@mongodb.com Spencer Brody (Inactive)
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: