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

Errors do not get stack traces in 6.3.x #4250

Closed
aaronjensen opened this issue Oct 12, 2018 · 0 comments · Fixed by #5686
Closed

Errors do not get stack traces in 6.3.x #4250

aaronjensen opened this issue Oct 12, 2018 · 0 comments · Fixed by #5686
Assignees
Labels
bug Confirmed bug

Comments

@aaronjensen
Copy link

Bug Report

Current Behavior

Stack traces are no longer recorded on rxjs errors as of 6.3.0.

Reproduction

6.3.3 (e.stack is undefined):

https://stackblitz.com/edit/rxjs-yabcir?file=index.ts

6.2.2 (e.stack is defined):

https://stackblitz.com/edit/rxjs-8y9kt4?file=index.ts

My guess is that #3967 is what broke the traces.

Expected behavior
Errors have stack traces

Environment

  • Runtime: Chrome
  • RxJS version: 6.3.x

Possible Solution

Possibly do something like:

    if (!Error.captureStackTrace)
      this.stack = (new Error()).stack;
    else
      Error.captureStackTrace(this, this.constructor);
@benlesh benlesh added the bug Confirmed bug label Sep 1, 2020
@benlesh benlesh self-assigned this Sep 1, 2020
benlesh added a commit to benlesh/rxjs that referenced this issue Sep 1, 2020
NOTE: Because we have to workaround compilation-to-ES5 inadequacies until call stack locations will show as being inside of the constructor impelementation at the top level. This will go away as we are able to move the community to ES2015+

BREAKING CHANGE: Tests that are written with naive expectations against errors may fail now that errors have a proper `stack` property. In some testing frameworks, a deep equality check on two error instances will check the values in `stack`, which could be different.

fixes ReactiveX#4250
benlesh added a commit to benlesh/rxjs that referenced this issue Sep 1, 2020
NOTE: Because we have to workaround compilation-to-ES5 inadequacies until call stack locations will show as being inside of the constructor implementation at the top level. This will go away as we move the community to ES2015+

BREAKING CHANGE: Tests that are written with naive expectations against errors may fail now that errors have a proper `stack` property. In some testing frameworks, a deep equality check on two error instances will check the values in `stack`, which could be different.

fixes ReactiveX#4250
benlesh added a commit to benlesh/rxjs that referenced this issue Sep 3, 2020
NOTE: Because we have to workaround compilation-to-ES5 inadequacies until call stack locations will show as being inside of the constructor implementation at the top level. This will go away as we move the community to ES2015+

BREAKING CHANGE: Tests that are written with naive expectations against errors may fail now that errors have a proper `stack` property. In some testing frameworks, a deep equality check on two error instances will check the values in `stack`, which could be different.

fixes ReactiveX#4250
benlesh added a commit that referenced this issue Sep 3, 2020
* fix(errors): Custom RxJS errors now all have a call stack

NOTE: Because we have to workaround compilation-to-ES5 inadequacies until call stack locations will show as being inside of the constructor implementation at the top level. This will go away as we move the community to ES2015+

BREAKING CHANGE: Tests that are written with naive expectations against errors may fail now that errors have a proper `stack` property. In some testing frameworks, a deep equality check on two error instances will check the values in `stack`, which could be different.

fixes #4250

* refactor: Improve error class creator

- Adds tests

* chore: update side-effects golden files

* chore: address comments

* chore: update side-effects golden files again

* chore: I hate ts-api-guardian sometimes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants