When I tweeted about my solution, I was pointed to a few related projects and techniques:
- An article with various tips on logging JS errors.
- jserrlog.appspot.com: A solution hosted on App Engine, where you just drop in the JS and view the logs on their server.
Since deploying my solution, I've discovered that
window.onerror doesn't work in all browsers (even some "modern" ones like Android), so if you are looking to catch every error, you should checkout those links to see the workarounds they employ.
Update (2/20/2012): I've updated my function to ignore errors that I know aren't mine, like those generated from 3rd party scripts. I could also update it to just only show errors from my server's JS, but for now I'm interested in what other errors folks encounter. You can see that updated code in this gist.