Skip to content

Instantly share code, notes, and snippets.

Created December 10, 2013 19:32
What would you like to do?
client-side error beacon code in coffeescript
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''none'
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment