Ticket #6863 (closed defect: fixed)

Opened 6 months ago

Last modified 5 months ago

Debugging is broken

Reported by: guest Owned by: jburke
Priority: normal Milestone: 1.2
Component: General Version: 1.1.1
Severity: normal Keywords: debug debugger try exception
Cc: peller

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

Changed 6 months 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?

Changed 6 months ago by jburke

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.

Changed 6 months ago by peller

  • cc peller added

Changed 6 months ago by jburke

  • owner changed from anonymous to jburke

Changed 5 months ago by jburke

  • status changed from new to closed
  • resolution set to fixed

(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)

Changed 5 months ago by jburke

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

Note: See TracTickets for help on using tickets.