Git Product home page Git Product logo

Comments (6)

caiyue1993 avatar caiyue1993 commented on August 18, 2024 4

@IngmarStein @harryworld @insidegui

Gentlemen, I've received a pull request from @randycarney and made lots of changes to that. And I am really happy to announce that:

IceCream is equipped with a powerful ErrorHandler now!

For the details, you guys could take a look the #15. In that pr, ErrorHandler has taken care of all the error codes that CloudKit returns.

Check it now! Thanks to all of you.

from icecream.

harryworld avatar harryworld commented on August 18, 2024 1

In practice, we always handle these following errors:

  1. limitExceeded 400 records per operation, or 2MB per request -> Split it
  2. quotaExceeded iCloud space is used up -> Show alert message
  3. partialFailure in case of using default savePolicy

In addition, one may optionally handle the unrecoverable errors like

  1. unknownItem
  2. internalError

from icecream.

insidegui avatar insidegui commented on August 18, 2024

@caiyue1993 This can be fixed by splitting the items into batches of at most 400 at a time.

from icecream.

caiyue1993 avatar caiyue1993 commented on August 18, 2024

@IngmarStein Thanks a lot for raising this issue and detailed suggestions! IceCream library truly should handle this case.

And yep, we could fix this by the way @insidegui suggested.

I'm on it and keep tuned.

from icecream.

caiyue1993 avatar caiyue1993 commented on August 18, 2024

@harryworld I appreciate it a lot!

Thanks for you practical advice and I'll check out my code. 👍

from icecream.

randycarney avatar randycarney commented on August 18, 2024

I just submitted a pull request from my fork CKErrorHandler to address the errors specifically where appropriate, based on the error handling from the GitHub library EVCloudKitDao: https://github.com/evermeer/EVCloudKitDao.

It basically divides all the potential CKError codes into CKErrorTypes that you can switch on and handle with custom code.

 public enum CKErrorType {
        case success
        case retry(afterSeconds: Double)
        case recoverableError(reason: CKFailReason)
        case chunk
        case fail(reason: CKFailReason)
    }

public enum CKFailReason {
        case changeTokenExpired
        case quotaExceeded
        case partialFailure
        case serverRecordChanged
        case shareRelated
        case unhandledErrorCode
        case unknown
    }

It also provides a NSLog message copied from the Apple Documentation that could be turned into a button to notify the user easily.

I implemented CKErrorHandler in all the places in SyncEngine it would be currently appropriate as far as I can tell.

I also made the CKModifyRecordsOperation .isAtomic flag true to avoid CKError.partialFailure errors, though some may want to handle those specifically.

Let me know what you think!

from icecream.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.