Skip to content
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

support the non-standard Error.stack property #180

Merged
merged 1 commit into from
May 2, 2016

Conversation

deoxxa
Copy link
Collaborator

@deoxxa deoxxa commented Apr 30, 2016

Popular runtimes (V8 1, SpiderMonkey 2, IE 3) support a stack
property on Error objects to get the error's stack as a string.

This change adds support to otto for this same feature. It's implemented
in a similar way to V8, using a getter function. This avoids generating
the stack trace (which is done in a loop with string manipulation etc)
unless the user requests it. There's no standard, or even trend, for the
actual content of stack, so we basically just copy what V8's traces
look like.

Popular runtimes (V8[1], SpiderMonkey[2], IE[3]) support a `stack`
property on Error objects to get the error's stack as a string.

This change adds support to otto for this same feature. It's implemented
in a similar way to V8, using a getter function. This avoids generating
the stack trace (which is done in a loop with string manipulation etc)
unless the user requests it. There's no standard, or even trend, for the
actual _content_ of `stack`, so we basically just copy what V8's traces
look like.

[1]: https://github.com/v8/v8/wiki/Stack%20Trace%20API
[2]: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Error/stack
[3]: http://msdn.microsoft.com/en-us/library/windows/apps/hh699850.aspx
@deoxxa deoxxa merged commit 353d16e into robertkrimen:master May 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant