node.js access to v8's "raw" CallSites -- useful for custom traces, c-style assertions, getting the line number in execution etc
by tjJavaScript
Last 12 weeks · 0 commits
2 of 6 standards met
I am working on a game that uses the callstack to perform security checks. I create virtual filenames to store a filename and an instance ID so I can locate the actual object instance using the information provided by callsite. I do not appear to be getting the entire stack trace, though (my virtual scripts don't appear in the trace, now). I am running Node 8.9.3 on Windows 10 for development. Produces a stack like: Visual Studio on the other hand shows my callstack with more than twice as many frames (see attached). Why the discrepancy? How do I get ALL the frames on the stack? !callstack2vs (Updated with better example)
When in strict mode ( at the top of the file) throws an error. This came up for me because Babel's require-hook was transpiling this file - yes i know it probably shouldn't. A nasty bug though because it occurs while the stack trace has been replaced, which makes it hard to find, printing an obscure message to the console. The workarounds: configure Babel to blacklist to avoid adding strict to the top of the file. configure Babel to ignore . Regardless I propose the following change to make sure the error gets thrown if for some reason is placed at the top of this file:
Repository: tj/callsite. Description: node.js access to v8's "raw" CallSites -- useful for custom traces, c-style assertions, getting the line number in execution etc Stars: 248, Forks: 11. Primary language: JavaScript. Languages: JavaScript (96.7%), Makefile (3.3%). License: MIT. Open PRs: 1, open issues: 5. Last activity: 11y ago. Community health: 42%. Top contributors: tj, humanchimp, tchollingsworth, prescod.