azicchetti / jquerymobile-router

A router/controller for jquery mobile. Also adds support for client-side parameters in the hash part of the url. The routes handles regexp based routes. This plugin can be used alone or (better) with Backbone.js or Spine.js, because it's originally meant to replace their router with something integrated with jQM.
GNU General Public License v2.0
402 stars 69 forks source link

Debugging snippet gets in the way #73

Open mzedeler opened 11 years ago

mzedeler commented 11 years ago

This snippet:

var DEBUG = true;
function debug(err){
  if (DEBUG) {
    console.log(err);
    if (err.stack){ console.log(err.stack); }
  }
}

Seems to get more in the way than actually helping because Internet Explorer doesn't have a console object, so using debug in a try-catch block will just throw away what really went wrong and replace the actual error with something else.

I have two proposals to resolve this:

I can implement both of the above, so just let me know which one and I'll do it.

azicchetti commented 11 years ago

I'd go for the second solution. Adding a configuration option [defaulting to console.log, if console.log() exists and nothing is provided by the user] to pass the debug handler seems a safer way to handle this problem.

mzedeler commented 11 years ago

Ok. I'll get to work on it.

(Unless you want to, of course.)

azicchetti commented 11 years ago

I'm a little busy a.t.m., any help is greatly appreciated. But don't worry, if you don't have time to write the patch, I think I can push the change (plus another small feature someone suggested via email) in the next few days.

Thank you for spotting the issue

mzedeler commented 11 years ago

I won't be able to fix it until some time this wednesday. I'll just check the issue here by then to see if you have a fix ready.