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

Iterate over Result<T> in MongoCursor

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0.0-rc0
    • Component/s: None
    • Labels:
      None

      Description

      Currently, we have no way of signaling to users (or ourselves) that an error has been encountered while iterating a cursor via next(), since that method cannot throw according to the Sequence protocol. In order to determine if an error has occurred, one must check the  .error property on the cursor after iteration has completed, which is easy to forget (as evidenced by SWIFT-652 and some user cases).

      In order to signal to users than errors have occurred, we could iterate over Result<T> instead of just T, similar to how it is done in the Rust driver.

        Attachments

          Activity

            People

            Assignee:
            ali.mir Ali Mir
            Reporter:
            patrick.freed Patrick Freed
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: