Reputation: 2694
We're building a project with RequireJS and Node, and reusing modules both server and client side. It's going pretty good so far (some small kinks to work out).
An issue seems to be that errors inside a deferred callback don't ever get displayed in the node console (or in any other way for that matter). Making it very hard to debug.
asdasdasd(); // Throws error, function is undefined, as intended
this.loadOrganization(organization_key, true).then(function(org) {
asdasdasd(); // No error anywhere, script just stops executing
});
loadOrganization returns a deferred object, and the callback gets called fine - However no error messages pertaining to undefined are displayed (general syntax errors are reported by node when evaluating the module).
We bootstrap content for the browser on the serverside using jsdom with jquery. And then pass the jquery from jsdon to most methods - So the deferred object used for the loadOrganization is the one from jQuery via jsdom. Changing the deferred used to one from npm installed jquery however makes no difference.
Any suggestions would be helpful, its pretty hard to debug when there are no errors printed.
Upvotes: 1
Views: 106
Reputation: 2694
Figured it out, was a wild try/catch statement in our Backbone.Sync implementation on the serverside. Which meant that anything going through the API (which is pretty much anything) was being caught by a try/catch that passed the error on to the Backbone.Sync error callback, and was never heard from again.
So moral of the story; Look through your code for Try/Catches if no errors are outputted.
Upvotes: 1