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

Runtime errors carry incomplete stack trace #329

Closed
altaurog opened this issue Oct 24, 2018 · 0 comments · Fixed by #465
Closed

Runtime errors carry incomplete stack trace #329

altaurog opened this issue Oct 24, 2018 · 0 comments · Fixed by #465

Comments

@altaurog
Copy link

Errors propagated up from a throw statement carry a full stack trace (#179), but other errors do not.
For example, when I run the following code:

run(a);
run(c);

function run(fn) {
  try {
    fn();
  } catch (err) {
    console.log(err.stack + '\n');
  }
};

function a() { b() }
function b() { throw new Error('full stack trace') }
function c() { d() }
function d() { return 'x'.join(',') } // partial stack trace

I get this output:

Error: full stack trace
    at b (/tmp/stacktest.js:13:26)
    at a (/tmp/stacktest.js:12:16)
    at run (/tmp/stacktest.js:6:5)
    at /tmp/stacktest.js:1:1


TypeError: 'join' is not a function
    at run (/tmp/stacktest.js:6:5)
    at /tmp/stacktest.js:2:1

I'd like the latter stack trace to include at c and at d.

stevenh added a commit that referenced this issue Nov 28, 2022
Fix stack being truncated due to double conversion to _error.

Fixes #329
stevenh added a commit that referenced this issue Nov 28, 2022
Fix stack being truncated due to double conversion to _error.

Fixes #329
sg3des pushed a commit to sg3des/otto that referenced this issue Jul 17, 2023
Fix stack being truncated due to double conversion to _error.

Fixes robertkrimen#329
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 a pull request may close this issue.

1 participant