Uploaded image for project: 'AeroGear'
  1. AeroGear
  2. AEROGEAR-8345

[DataSync] Error handling for offline mutations

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • None
    • None
    • None

      When client is going back online and there is an error when applying offline mutations (e.g. server is down), it is not always possible to handle errors.

      One scenario is when client is offline and then going back online (no app restart, browser page refresh). If the client makes some mutations while offline, then when it goes back online, the promises returned from mutation calls will reject (e.g. if server is down). So in this case it is possible to handle errors, but it is up to client developer to keep track of those promises and handle them somehow.

      Other scenario is when client is offline, there are some offline mutations, then app is restarted and is online. In this case if there are errors when applying offline mutations, client developer is not able to handle them (failed mutations are put back to offlineMutationQueue).

      One possible solution might be to allow developer to provide callback (e.g. with OfflineQueueListener [1]) which would inform him about failures when applying offline mutations. (It could also inform about successes).

      For the first scenario, would it make sense to resolve/reject promise once the mutation is stored in offline mutation queue and let developer use OfflineQueueListener's callback to handle failure/success?

      ping wtrocki@redhat.com

      [1] https://github.com/aerogear/aerogear-js-sdk/blob/master/packages/sync/src/offline/OfflineQueueListener.ts

            jhellar@redhat.com Jan Hellar (Inactive)
            jhellar@redhat.com Jan Hellar (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: