Created
December 16, 2012 02:51
-
-
Save anonymous/4302682 to your computer and use it in GitHub Desktop.
An onerror handler that's a helluva lot more useful than `... catch(e) { alert(e) }`. You can easily hook this into a custom Google Analytics event to log your app's errors. [inspiration](http://bytes.com/topic/javascript/answers/90742-try-catch-error-handling-display-line-number)
This file contains hidden or 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
onerror = (err, file, line) -> | |
logger """ # console.log, alert, whatever | |
The following error occured: #{err} | |
In file: #{file} | |
At line: #{line} | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment