3 ms·
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
by jcampbell1 13y ago
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);