Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging snippet gets in the way #73

Open
mzedeler opened this issue May 13, 2013 · 4 comments
Open

Debugging snippet gets in the way #73

mzedeler opened this issue May 13, 2013 · 4 comments

Comments

@mzedeler
Copy link
Contributor

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:

  • Remove this function and all references to it.
  • Expose an attribute that can contain a reference to a callback that receives debug calls.

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

@azicchetti
Copy link
Owner

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
Copy link
Contributor Author

Ok. I'll get to work on it.

(Unless you want to, of course.)

@azicchetti
Copy link
Owner

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
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants