Browse files

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

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
  • Loading branch information...
1 parent d29c35d commit 1164588e56f475849e58ff9c2e7c1b975f6f505b @sukima committed Dec 13, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 js/
5 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;

0 comments on commit 1164588

Please sign in to comment.