Hacker News new | past | comments | ask | show | jobs | submit login

The advantage to the try() method is you get stack traces for browsers other than Chrome. With Chrome you can get the stack trace easily. just do:

    window.onerror = function(msg,url,line,col,err) { 
      console.log(err.stack) 
    }
If that doesn't work for you, you can get it like:

    window.onerror = function() {
      console.log(window.event.error.stack)
    }

I wouldn't want litter my code with Airbrake.try(); onerror is good enough since you get stack traces from Chrome. When there is a pesky error, I tend to do something like:

    throw JSON.stringify(some_var_to_watch);



Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: