I wrote a small gem for Ruby on Rails that does this (tastes_bitter on RubyGems). It's very basic, and doesn't handle browsers which don't support all of the attributes, such as stack trace, yet. I'd like to implement a polyfill for it like you've described in your post!