error function not defined #148

Closed
pushkin- opened this Issue Aug 7, 2015 · 5 comments

Projects

None yet

2 participants

@pushkin-
pushkin- commented Aug 7, 2015
relayErrorCallback = function(xhr) {
   var online;
   online = !hasOfflineStatusCode(xhr);
   if (online || method === 'read' && !options.storeExists) {
     return error(xhr);
   } else {
     return useOfflineStorage();
   }
 };

It appears that error is not defined anywhere.

@nilbus
Owner
nilbus commented Aug 12, 2015

error is defined in the closure of the dualsync function, where it is defined. It refers to the error callback passed in to Backbone.sync (after being translated to support multiple Backbone versions).

https://github.com/nilbus/Backbone.dualStorage/blob/1528f32441339e93f1a6fc9d70bb3587fa594e7f/backbone.dualstorage.js#L348

Did this cause you an error, or were you analyzing the code?

@nilbus nilbus closed this Aug 12, 2015
@pushkin-

@nilbus Hmm. It caused me an error.

@nilbus nilbus reopened this Aug 12, 2015
@nilbus nilbus self-assigned this Aug 12, 2015
@nilbus
Owner
nilbus commented Aug 12, 2015

Are you on Backbone 0.9.10? Assuming not…

If error was undefined, that means that dualsync (Backbone.sync) was called with an undefined options.error callback. That should be impossible with a vanilla version of backbone, which always calls wrapError to define options.error (see http://backbonejs.org/docs/backbone.html).

Let me know if you figure out what's happening here.

@pushkin-

No I don't believe I am using Backbone 0.9.10.

My internship ended, so I don't have access to my code anymore, and replicating it will be difficult. However, I will let you know if I figure something out.

@nilbus
Owner
nilbus commented Aug 13, 2015

Okay. Sorry I couldn't get to this sooner then! I'll close this since we can't reproduce it now, but it will be here for someone to find if they run into the same problem.

Thanks for all your help reporting issues :) 👏

@nilbus nilbus closed this Aug 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment