Greg
Greg

Reputation: 1629

Why do non-dojo javascript errors appear to orignating by dojo.xd.*.js in chrome?

I'm having a problem where all my javascript errors appear to be coming from dojo.xd.js or a sub-module. I'm using chrome debugger and many dijit features such as dijit.declaration and dojo.parser.

This is a bit annoying as it makes it hard to locate simple errors or slip ups. I'm hoping I can add an option that allows my debugger to show where in my non-dojo code a option would occur. I'm new to dojo so I might be making a simple mistake.

Example error from what should be a nullpointexception in non-dojo code:

typeError                                   
    dojo.Deferred.reject.errback                             dojo.xd.js:14

Upvotes: 4

Views: 1042

Answers (2)

mtyson
mtyson

Reputation: 8560

I think missingno's suggestion is a good one (worth a try - I haven't used the method).

Also, another way I've used to get at the erroring code is:

  1. Set a breakpoint in the dojo code where the error is showing
  2. Use the stack breadcrumb navigator and move backwards into the code that threw the error

In Firebug, the stack navigator is just above the script listing that shows the breakpoint.

Upvotes: 0

hugomg
hugomg

Reputation: 69954

Errors that occur inside deferred and async chains are handled by Dojo and that can confuse the error messages a bit.

If you are using the chrome debugger you can tell it to immediately halt the program execution whenever an exception occurs by clicking on the "stop sign" in the "Script" tab until it turns blue.

Upvotes: 4

Related Questions