Skip to content
This repository has been archived by the owner on Jul 14, 2022. It is now read-only.

Implement V8's stack trace API #15

Open
gbrail opened this issue Jul 14, 2014 · 0 comments
Open

Implement V8's stack trace API #15

gbrail opened this issue Jul 14, 2014 · 0 comments

Comments

@gbrail
Copy link

gbrail commented Jul 14, 2014

For better compatibility with V8, we will add an implementation of the stack trace API from V8, as defined here:

https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi

Specifically, we'll add a new method methods:

Error.captureStackTrace(object)

This will add a string property called "stack" to the specified object that contains the stack trace from the current point.

The actual V8 implementation takes an optional second parameter that specifies a function where the stack trace should be trimmed -- we will NOT implement this parameter.

In addition, if the user assigns a function to the property:

Error.prepareStackTrace

then we will call it when formatting any stack trace, passing it an array of CallSite objects. This will work as much like V8 as we can make it, which means that we will implement all the functions on CallSite, although only the following ones will be able to work reliably:

getFunctionName()
getFileName()
getLineNumber()

These APIs will be supported in both interpreted and compiled mode.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant