Consider returning an error when iterating a dead cursor

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Works as Designed
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The Swift driver returns errors when users begin iterating a dead cursor:

      for x in cursor {
          // no errors in here
      }
      print(cursor.next()) // LogicError("cannot iterate a dead cursor")
      

      We should consider doing something similar in the Rust driver.

      The rationale for doing so is that a user iterating a dead cursor is probably indicative of a programmer error:

      • In the "eager" cursor, it could only happen if they're not using a while let loop or if they start iterating after their while let loop ended, both likely errors.
      • In the "non-eager" case, it means they're not distinguishing between a cursor being exhausted and returning None, which is also usually an error since it can lead to infinite loops.

              Assignee:
              Unassigned
              Reporter:
              Patrick Freed
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: