-
Notifications
You must be signed in to change notification settings - Fork 108
error callback should be called if online fetch fails and no local cache is available #91
Comments
This is by design. Although it failed to persist to the server, the overall dualSync operation was a success, since it persisted locally. To check if the server request failed, you can use the jQuery fail callback (see #67) or check |
I see, I can understand that logic although i might be wrong but it seems to handle the following cases as following, which are a bit odd i think explicit request { local: false } -> check server -> server fail -> no local store -> resolves with success empty collection or no local store -> check server -> server fail -> no local store -> resolves with success empty collection |
For your first example, use I don't follow what exactly you mean in your second example by "no local store" and "check server". Could you be more specific? |
ah great, i'll try that for the first instance. The second example is:
thanks |
No, in the 2nd example, it will call success with an empty collection, you are right. Right now I am uncertain whether from what gets stored now if we can distinguish from the data in the local Store between no-previous-successful-fetch and successful-previous-fetch-with-empty-collection. We certainly don't track that explicitly. If you'd like to look into making it, on ajax error, call the error callback on the first fetch before any data is cached for a Store, I will work with you to get that merged in. |
Sure, I'll take a look and give it a go |
is there already a way of determining whether a local store currently exists? |
Closing in favor of the pull request |
I'm not getting an 'error' event when a server call fails. it seems that this line should be calling the error method rather than the success method?
https://github.com/nilbus/Backbone.dualStorage/blob/master/backbone.dualstorage.coffee#L290
The text was updated successfully, but these errors were encountered: