Skip to content

Instantly share code, notes, and snippets.

@roblevintennis
Last active May 12, 2017 17:54
Show Gist options
  • Save roblevintennis/231d72ebe85013011b85254dac2057c4 to your computer and use it in GitHub Desktop.
Save roblevintennis/231d72ebe85013011b85254dac2057c4 to your computer and use it in GitHub Desktop.
coffeescript stack trace
getStackTrace = ->
stack = (new Error).stack or ''
stack = stack.split('\n').map((line) ->
line.trim()
)
stack.splice if stack[0] == 'Error' then 2 else 1
onRender: ->
console.log("Custom stack trace:")
console.log(getStackTrace().join('\n'))
# The following works fine too, you just end up seeing absolutely every call in the stack trace
console.log("console.trace: ")
console.trace()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment