-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SM] stack[0].getFileName() missing #728
Comments
I've just tested the code above and it behaves as expected with SM build. |
Although I get get it to work in isolation, i appear to not be able to get it to work in my specific (more complex example). I'm going to try and isolate it further |
Actually, I believe my example is more similar to this SO response: http://stackoverflow.com/a/13227808 module.exports = getCallerFile;
function getCallerFile() {
var oldPrepareStackTrace = Error.prepareStackTrace;
Error.prepareStackTrace = function(err, stack) { return stack; };
var stack = new Error().stack;
Error.prepareStackTrace = oldPrepareStackTrace;
// stack[0] holds this file
// stack[1] holds where this function was called
// stack[2] holds the file we're interested in
return stack[2] ? stack[2].getFileName() : undefined;
} which, when run in > getCallerFile()
'repl.js' The example provided in #728 (comment) does not appear to work in v8@4.6.85.28 |
@stefanpenner Thanks for all the details. Fix will be part of 0.3.1.0 (ee19070) |
See #728 With this commit, SM Error tooling should be fairly compatible with v8
@obastemur very nice, will give 0.3.1.0 a go sometime. Keep up the good work! |
The V8 specific (I believe)
stack[0].getFileName()
method is missing in SM (and likely vms), some node code depends on this, to discover the location (on-disk) of a caller.If there is an alternative for SM, I could just implement it that way. Although it would be nice if some standard was eventually derived.
The text was updated successfully, but these errors were encountered: