How to detect sync errors in couchbase lite?

Hi,

We are using couchbase lite ios 1.1.1 and continuous replication to sync our data. We often have issues with clients not having their data sync and we want to detect a syncing error before a client contacts our customer support. How would we detect the following error in our code (or similar syncing errors)? We can see it in the logs if we enable certain flags, but ideally what we want is to actually detect the error in our code and send a notice to our server.

WARNING: CBL_Pusher[https://[host]/]: _bulk_docs got an error: {
error = forbidden;
id = “-qo9mf7UcK3j8g2A_zdIHF6”;
reason = “invalid document”;
status = 403;
}

@alexegli,

You want to get both CBL and SG version 1.2.0 as they are the best builds, Couchbase fixed lots of issues between the builds.

Also try using alphanumeric first letter not “-

We are wary of upgrading since the last time we did that the new version of sync gateway had a large performance bug introduced that took down our production server for a day. So we would need to thoroughly test any new versions before upgrading, which takes a few weeks to a month. We would like to enable this logging as soon as possible so we can’t really wait a month to do it. Does this mean there is no way in couchbase lite 1.1.1 to detect syncing issues? Aside from enabling a high level of logging, which we really don’t want to do on production since it impacts performance.

Those ids are auto-generated by couchbase lite. That error was intentional, we wanted to see what would happen in the client on a sync error.

This is the official method for logging. Logging · couchbase/couchbase-lite-ios Wiki · GitHub

CBL and SG version 1.2.0 is worth the upgrade. Here are the release notes: Couchbase Capella for Mobile Developers