iriscouch / traceback

Easy access to the call stack, for Node.js
Apache License 2.0
44 stars 6 forks source link

Friendly to environment that defines `Error.prepareStackTrace` #1

Open chakrit opened 11 years ago

chakrit commented 11 years ago

I am using CoffeeScript 1.6.3 which defines Error.prepareStackTrace at runtime.

From what I can tell from looking at traceback.js. You just need to swap in a replacement for prepareStackTrace right? Shouldn't that work regardless of wether the value is originally undefined or not?

Sorry if I misunderstood anything, its 4AM over here, will investigate more if/when I have time.

The actual use case that is blocking me is through the raven module (which uses raw-stacktrace which uses traceback)

Test case is very simple, just require 'traceback' in CS environment is enough to trigger it.

$ npm i traceback coffee-script
$ echo "require 'traceback'" > x.coffee
$ ./node_modules/.bin/coffee x.coffee

Error: Traceback does not support Error.prepareStackTrace being defined already
  at Object.<anonymous> (/private/tmp/node_modules/raw-stacktrace/node_modules/traceback/traceback.js:23:9)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (/private/tmp/node_modules/coffee-script/lib/coffee-script/coffee-script.js:211:36)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> (/private/tmp/node_modules/raw-stacktrace/node_modules/traceback/api.js:15:11)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (/private/tmp/node_modules/coffee-script/lib/coffee-script/coffee-script.js:211:36)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> (/private/tmp/node_modules/raw-stacktrace/index.js:2:17)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (/private/tmp/node_modules/coffee-script/lib/coffee-script/coffee-script.js:211:36)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> (/private/tmp/tmp.coffee:1:1, <js>:2:3)
  at Object.<anonymous> (/private/tmp/tmp.coffee:1:1, <js>:4:4)
  at Module._compile (module.js:456:26)
vjpr commented 9 years ago

+1

tzaitsev commented 7 years ago

+1

houkk commented 7 years ago

+1

x007007007 commented 6 years ago

+1