Just for clarification, I meant Object.getOwnPropertyDescriptor(new Error, "stack").get.apply(someError) (since Error.prototype.stack doesn't exist).
On Sunday, November 16, 2014 9:10:57 PM UTC-8, Francisco Tolmasky wrote: > > I am writing an application that wants to examine the state of an > application without mutating it. > If the application throws an error, I'd like to be able to grab the string > stack trace located in error.stack. > In JSCore for example, this isn't a problem because I can do > Object.getOwnPropertyDescriptor(error, "stack").value. > However, in v8, stack is a getter/setter, not a value. This would maybe > not be a problem if I could do something like > Error.prototype.stack.apply(myError). But, as it turns out it is a > *unique* getter for every error: > Object.getOwnPropertyDescriptor(new Error, "stack").get !== > Object.getOwnPropertyDescriptor(new Error, "stack").get. > As such, I would at the very least like to be able to make sure that its > the normal stack getter (in which case I can feel > safe that its not doing any funny business for example if the user has > overwritten it with their own custom stack getter > that mutates the state of the program, or possibly throws an exception > itself!). So far the best I can come up with is to check > whether the source of the getter is "function() { [native code] }" which > is obviously not ideal since this doesn't preclude the user > havign set the stack getter to a *different* native function. Is there any > way to achieve what I want that I'm missing? > > Thanks, > > Francisco > -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.