Created
December 10, 2013 19:32
-
-
Save eanakashima/7896696 to your computer and use it in GitHub Desktop.
client-side error beacon code in coffeescript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class YourNamespace.Errors | |
window.onerror = (e) => @report(e) | |
@report: (e) -> | |
img = new Image(1,1) | |
img.src = '//' + your_config.errors_host + '/images/error_pixel.gif' | |
img.style.display='none' | |
document.getElementsByTagName('body')[0].appendChild(img); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just a sketch. You may also want to check if window.onerror has already been set, since other code or third-party tools may already have set a handler there, and call that function as well.