Uploaded image for project: 'Scala Couchbase Client'
  1. Scala Couchbase Client
  2. SCBC-9

Evaluate if get operations should return Try[Option[T]] or Try[T]

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 1.0.0
    • None
    • None
    • None
    • 1

    Description

      Try[Option[T]] is perhaps more correct, and is more in line with the SDK3 RFC.

      Plus the Reactive API now returns Mono[Option[T]], as Mono.empty isn't easy to work with.  So this would give parity between the blocking, async and reactive APIs.

      However, Try[Option[T]] is also more unwieldy, requiring nested pattern matching or multiple maps() to simply get a document.

      Plus it means error handling logic must be done separately for a document not existing and for other errors.  With Try[T], this can be combined if the app wishes.

      And it doesn't lend itself to for-comprehensions at all, as you cannot mix Try and Option in a for-comprehension in any particularly nice way.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            graham.pople Graham Pople
            graham.pople Graham Pople
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty