ajbrown / angular-loggly-logger

An AngularJS module which sends your $log message to loggly, and provides a service for manually sending messages to loggly.
MIT License
32 stars 49 forks source link

stack isn't sent for errors caught by window.onerror #50

Closed jaketodaro closed 8 years ago

jaketodaro commented 8 years ago

The stack is only sent for errors caught by the $log provider (I think). Errors caught by window.onerror don't sent their stack. I think this code needs to change to log the stack from the error object.

window.onerror = function (msg, url, line, col, error) {
    logger.sendMessage({
        level : 'ERROR',
        message: msg,
        url: url,
        line: line,
        col: col,
        stack: error && error.stack
    });
...

Happy to send a PR.

ajbrown commented 8 years ago

@jaketodaro Thanks for pointing this out. If you want to do a PR, go ahead. We'll need to make sure this is covered in the unit tests if possible.

ajbrown commented 8 years ago

PR: #54