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

Projects
None yet
1 participant
@deoxxa
Copy link
Collaborator

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.

@deoxxa deoxxa referenced this pull request Apr 30, 2016

Closed

thrown errors missing info #179

@deoxxa deoxxa force-pushed the deoxxa:error-stack-property branch from cf57740 to 8739d2a Apr 30, 2016

support the non-standard Error.stack property
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 force-pushed the deoxxa:error-stack-property branch from 8739d2a to c03dfd3 May 2, 2016

@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