Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#6863 closed defect (fixed)

Debugging is broken

Reported by: guest Owned by: James Burke
Priority: high Milestone: 1.2
Component: General Version: 1.1.1
Keywords: debug debugger try exception Cc: Adam Peller
Blocked By: Blocking:

Description

Debugging is broken and complaints are long overdue. Since Firefox exceptions do keep track of the call stack, but Firefox or Firebug is unable to produce or show the correct lines of code (e.g., if document.write is used) and is therefore nearly useless for debugging, and since IE exceptions do not record the call stack if the exception is ever caught rather than being allowed to percolate to the top at which case source code is indeed accurately displayed, Dojo needs to be very careful about its try statements. For debugging purposes there should be an option to turn them off, perhaps coordinated with djConfig.isDebug. This should disable use of try in dojo.Deferred._fire, dojo._watchInFlight(), and dojo.loaded() so that errors in load code for xhr requests can be properly debugged.

Change History (6)

comment:1 Changed 11 years ago by bill

Yeah, I find all the try/catches very annoying too, in particular this one from loader.js which masks errors in all the widgets (at least the declarative ones):

try{
	mll[x]();
}catch(e){
	throw e;
	console.error("dojo.addOnLoad callback failed: " + e, e); /* let other load events fire, like the parser, but report the error */
}

I assume this ticket is from Alex?

comment:2 Changed 11 years ago by James Burke

So it sounds like for this to work, we need to break out code that does try/catch into two functions (one with no try/catch, one that does a try catch around that one), then in the code use something like dojo.config.isDebug ? directCall() : tryCatchCall();

I can see using isDebug for this purpose to be a reasonable flag to use.

comment:3 Changed 11 years ago by Adam Peller

Cc: Adam Peller added

comment:4 Changed 11 years ago by James Burke

Owner: changed from anonymous to James Burke

comment:5 Changed 11 years ago by James Burke

Resolution: fixed
Status: newclosed

(In [14137]) Fixes #6863. Only use try/catch in the djConfig.isDebug = false case. Otherwise, let the original exception escape to allow easier debugging. \!strict for _base/fx.js (error on line unrelated to changes for this ticket)

comment:6 Changed 11 years ago by James Burke

r14255 also applies to this ticket (trac svn updates not working again?)

Note: See TracTickets for help on using tickets.