Add assert.throwsCode shell helper for testing

XMLWordPrintableJSON

    • Fully Compatible
    • Query Execution 2021-05-31, Query Execution 2021-06-14, Query Execution 2021-06-28
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      We have a helperĀ assert.throws() which returns the error which was thrown. A common pattern looks like this:

      let err = assert.throws(() => coll.aggregate(...));
      assert.eq(err.code, expectedCode);
      

      We should add a helper to the assertion library to condense this and simplify some of our tests. It will be a good counterpart to assert.commandFailedWithCode.

            Assignee:
            Sebastien Mendez
            Reporter:
            Charlie Swanson
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: