Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Adds better stack trace to error messages #67

Merged
merged 1 commit into from

2 participants

@sukima

Found that in Chrome when an error happens in say a handler function the
try/catch block would catch the error and pass it along to the debug()
method. The problem is that when the debug function in turn does a
console.log(err) it looses the stack trace and your not able to see what
happened.

This might be the limitations of Chrome's console but adding the
err.stack allows the developer a peek into the cause of any errors
thrown.

@sukima sukima Adds better stack trace to error messages
Found that in Chrome when an error happens in say a handler function the
try/catch block would catch the error and pass it along to the debug()
method. The problem is that when the debug function in turn does a
console.log(err) it looses the stack trace and your not able to see what
happened.

This might be the limitations of Chrome's console but adding the
err.stack allows the developer a peek into the cause of any errors
thrown.
1164588
@azicchetti azicchetti merged commit 0cdc684 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 13, 2012
  1. @sukima

    Adds better stack trace to error messages

    sukima authored
    Found that in Chrome when an error happens in say a handler function the
    try/catch block would catch the error and pass it along to the debug()
    method. The problem is that when the debug function in turn does a
    console.log(err) it looses the stack trace and your not able to see what
    happened.
    
    This might be the limitations of Chrome's console but adding the
    err.stack allows the developer a peek into the cause of any errors
    thrown.
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 1 deletion.
  1. +4 −1 js/jquery.mobile.router.js
View
5 js/jquery.mobile.router.js
@@ -38,7 +38,10 @@ $(document).bind("mobileinit",function(){
var DEBUG=true;
function debug(err){
- if (DEBUG) console.log(err);
+ if (DEBUG) {
+ console.log(err);
+ if (err.stack) console.log(err.stack)
+ }
}
var previousUrl=null, nextUrl=null, ignoreNext=false;
Something went wrong with that request. Please try again.