CKError.Code - partialFailure and limitExceeded

Hi all,


I would like to know all the possible values of CKError.Code for a partialFailure.


My assumption:


Below stated are my assumptions, I could be completely wrong, so feel free to correct me.


Presently I am only handling the following CKError.Code for apartialFailure

.serverRecordChanged  //Only applicable while saving records
.zoneNotFound //Only applicable while fetching zones
.unknownItem  //Only applicable while saving / fetching items
.batchRequestFailed //Only applicable while saving records in custom zone



Questions:

  1. For
    partialFailure
    , are the above stated the only possible error codes ?
  2. Are the errors
    serverRecordChanged
    ,
    zoneNotFound
    ,
    unknownItem
    only possible as part of
    partialFailure
    error ? (Would the error returned by the completion handler not directly contain
    serverRecordChanged
    ,
    zoneNotFound
    ,
    unknownItem
    but only
    partialFailure
    error may contain them ?)
  3. Are my comments regarding when each of the above error correct ? (Only applicable while...)
  4. Is
    limitExceeded
    error thrown for
    CKFetch
    operations and
    CKModify
    operations or is it only applicable for
    CKModify
    operations ?


Thanks.

Replies

The partialFailure is just a way to report back that for the operation you were attempting to perform (of which there are several that operate on multiple items in a single operation, CKAcceptSharesOperation, CKFetchSubscriptionsOperation, CKFetchRecordsOperation, at a minimum) a subset of the items encountered errors. So the set of error codes that can be reported are really more a function of the operation that you were performing. I'd look to the headers and documentation for the guidance on which errors are applicable for which operations, and if any of them are not clear the best thing to do is to get bugs filed against our documentation to make them more clear (yes, we track documentation issues in the same bug database).

I meant to add that several of our prior year WWDC videos have talked a bit about error handling, specifically from 2016 CloudKit Best Practices has an Error Handling section, as well as from 2014 in the Advanced CloudKit session.

Thanks pdm for the response,


Sorry for my delayed reply, I didn't notice the reply to the post.


Yeah the video is really helpful. The video shows the type of retry errors and fatal errors.


As of now I am handling some of the common ones.


I agree, based on the operation, the type of errors applicable might vary and may not be necessary to handle all of them for a certain operation.

I couldn't find any documentation on the type of errors applicable for each operation.

It would help to have them documented.


I will file a bug report for it.


Approach for partialError:

If I have a function for handling errors in a specific operation, then if partialError is encountered, do I have to go through all induvidual errors and examine whether each of them is a fatal / retry error, accumulate the set of retry errors into an operation and reissue them ? (Also accumulating those retry based on the CKErrorRetryAfterKey) ?


I do understand, errors are specific to the operation performed, just wanted to if it is ever possible for the partialError to contain a limitExceededError ? Technically yes it is a CKError and can contain any CKError, but was trying to see if it is something that I can skip as a limitExceededError inside a partialError or might be possible.

I have filed a bug for CloudKit documentation to specify the list of errors applicable for every CloudKit Operation. Thanks