I'm looking for some guidance in debugging backbone.js. I'm following the Daily.js backbone tutorials and have run into a bug after week 9 (http://dailyjs.com/2013/01/24/backbone-tutorial-9/).
This is the error I have
[22:47:29.339] "calling request execute" [22:47:29.423] GET http://localhost:8080/img/glyphicons-halflings.png [HTTP/1.1 304 Not Modified 1ms] [22:47:29.424] POST https://content.googleapis.com/rpc?key=xxxxxxx [HTTP/1.1 200 OK 168ms] [22:47:29.546] ReferenceError: id is not defined @ http://localhost:8080/js/lib/underscore.js:1209 [22:47:29.543] "calling options success"
Here's the code with corresponding console logging calls:
Backbone.gapiRequest = function(request, method, model, options) { var result; console.log("calling request execute") request.execute(function(res) { if (res.error) { if (options.error) options.error(res); } else if (options.success) { if (res.items) { result = res.items; } else { result = res; } console.log("calling options success"); options.success(model, result, request); } console.log("gapiRequest") }); };
To things are throwing me presently:
- why the last log (of gapiRequest) isn't being displayed.
- why the error occurs between the two console logs, even though nothing in the code refers to id or, as far as i can see, any external libs.
If anyone is aware of what may be happening that would be great, any info on how to debug this would be very good as well. Can stack traces be produced in current web browsers?
TIA, Matt