Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-1089

document::element::operator[] overloads should not throw when given an invalid element

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0.3
    • Component/s: BSON
    • Labels:
      None
    • Backwards Compatibility:
      Major Change
    • Story Points:
      1
    • Sprint:
      Perl/CXX 2016-11-11

      Description

      bsoncxx::document::element::operator[] is documented as non-throwing, however the expression bsoncxx::document::element{}["foo"] throws.

      A fix for this issue was attempted in CXX-862, but the fix was incomplete.

      Original description:

      bsoncxx::document view blubb;

      if( blubb["jolo"] )
      => false

      if( blubb["jolo"][1] )
      terminate called after throwing an instance of 'bsoncxx::v_noabi::exception'
      what(): unset document::element
      For this, can the exception say, that I'm out of bound of a array, or that no array is existing?
      Most awesome would be if the exception would tell the non existing position.

      This behavior is a bit misleading. I would assume for both the upper behavior in just returning a true or false.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              david.golden David Golden
              Reporter:
              Weltenbummler Armin Ball [X] (Inactive)
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: