Clarifying the docs

24 views
Skip to first unread message

Jannie Theunissen

unread,
Dec 3, 2014, 9:02:35 AM12/3/14
to mobile-c...@googlegroups.com
So, I am very new to Couchbase and busy using Couchbase Lite in a Xamarin (c#) mobile app.  
I need some clarification to the API documentation for the document.putProperties method.
Specifically, I want to handle failures. The docs says:

Returns an error if an error occurs while creating or saving the new Revision.

But the documentation also says that the method returns a SavedRevision object

In a the Xamarin docs they have this example :

SavedVersion newVersion = doc.PutProperties(newProperties);
   
if (!newVersion)
       
ShowErrorAlert("Couldn't update the item.");

which is clearly outdated and doesn't work. My compiler says:

The '!' operator cannot be applied to operand of type 'Couchbase.Lite.SavedRevision' 

I have seen more recent examples that seem to indicate that a CouchbaseLiteException is thrown if the save was unsuccessful, but the docs doesn't mention this.

Can someone please point me to an example of how we should be detecting / handling an error. 

Zack Gramana

unread,
Dec 3, 2014, 6:16:24 PM12/3/14
to mobile-c...@googlegroups.com
Very good question!

There was an API change when we switched the Xamarin component from the old iOS binding to the C# implementation. When I updated the Xamarin component’s getting started guide, I missed that line.

It’s fixed in our repository[1], and will be updated in our next release.

The line should be: `if (newVersion == null)`.

Thanks for bringing this to our attention.

Regards,
Zack


--
You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobile-couchba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/bc8aad81-ac9e-4cb7-b1ab-bbc6c71eb758%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jannie Theunissen

unread,
Dec 5, 2014, 4:07:56 AM12/5/14
to mobile-c...@googlegroups.com
Thanks, Zachary!

If you are right then the official Couchbase API docs also needs to be corrected, because it says that "an error" will be returned.

Reply all
Reply to author
Forward
0 new messages