Skip to content

Instantly share code, notes, and snippets.

@mfpiccolo
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfpiccolo/04a315b64ca7a58e651b to your computer and use it in GitHub Desktop.
Save mfpiccolo/04a315b64ca7a58e651b to your computer and use it in GitHub Desktop.
class App.Logger
@add_error: (error_object) ->
@error ||= []
@error.push(error_object)
jQueryInit = $.fn.init
$.fn.init = (selector, context) ->
element = new jQueryInit(selector, context)
if selector and element.length is 0
# must include stacktrace library
# https://github.com/stacktracejs/stacktrace.js/blob/stable/dist/stacktrace.js
App.Logger.add_error({selector: selector, stack_trace: printStackTrace()})
element
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment