Uploaded image for project: 'Couchbase Documentation'
  1. Couchbase Documentation
  2. DOC-10300

example in Real-World Error Handling section is buggy

    XMLWordPrintable

Details

    Description

      In the example, you make condition on maxAttemps but this is wrong .When you do that, at first insertion try, if the error is gocb.ErrDocumentExists, then it should return error but in this code it will return nil, cause maxAttempts == 0 check will return false. On another case, lets say server will give timeout error 3 times, so this code will try 3 times to insert. So maxAttempts will be 0 cause it is decreased by one every iteration. In this case when last insert call return gocb.ErrDocumentExists, we expect to return nil but due to maxAttemps is 0, maxAttempts == 0 will return error and final response will be error but it should return nil. I will add the fixed solution to the attachment.

      Reporter: SAFA YILDIRIM
      E-mail: safayildirim54@gmail.com

      Attachments

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

        Activity

          People

            richard.smedley Richard Smedley
            docsite-collector Docs Site Collector
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty