Uploaded image for project: 'Swift Driver'
  1. Swift Driver
  2. SWIFT-503

Validate that w and wtimeoutMS are non-negative in WriteConcern initializer

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.2.0
    • Component/s: None
    • Labels:

      Description

      The WriteConcern spec tests contain a couple of cases checking for invalid values of wTimeoutMS and w. (Specifically, it tests negative values.)

      Currently we skip these in ReadWriteConcernTests.testDocuments, because the initializer relies on libmongoc to validate the options, and libmongoc does not consider those to be invalid values.

      However, we could just validate ourselves that they are non-negative. 

      We should update the WriteConcern initializer that looks like this: 

      public init(journal: Bool? = nil, w: W? = nil, wtimeoutMS: Int64? = nil) throws

       

      to throw a UserError.invalidArgumentError when either w or wtimeoutMS is < 0.

        Attachments

          Activity

            People

            Assignee:
            nataly.carbonell Nataly Carbonell (Inactive)
            Reporter:
            kaitlin.mahar Kaitlin Mahar
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: