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

Ensure stack is present for custom errors (fixes #351) #360

Merged
merged 1 commit into from Jul 30, 2017

Conversation

not-an-aardvark
Copy link
Contributor

@not-an-aardvark not-an-aardvark commented Jul 30, 2017

Starting in Node 7, stack traces are computed eagerly when using Error.captureStackTrace (link). As a result, the message and name properties of an error will not be included in the stack property if they are set after calling Error.captureStackTrace. As a workaround, set the properties before calling Error.captureStackTrace.

Note that this change in Node was reverted in V8 a few days ago (link), but it will probably be awhile until that fix appears in a Node release.

Fixes #351

Starting in Node 7, stack traces are computed eagerly when using Error.captureStackTrace [1]. As a result, the `message` and `name` properties of an error will not be included in the `stack` property if they are set after calling `Error.captureStackTrace`. As a workaround, set the properties before calling `Error.captureStackTrace`.

Note that this change in Node was reverted in V8 a few days ago [2], but it will probably be awhile until that fix appears in a Node release.

[1] https://chromium.googlesource.com/v8/v8.git/+/4feafee9d9741259e8ec3882fb61935a235ecc54
[2] https://chromium.googlesource.com/v8/v8.git/+/989d7b96f8352b502e2ede62e0b105e143d03837
@puzrin puzrin merged commit 698f65b into nodeca:master Jul 30, 2017
@not-an-aardvark not-an-aardvark deleted the fix-missing-error-stack branch July 30, 2017 07:27
@puzrin
Copy link
Member

puzrin commented Jul 30, 2017

Thank you! Released 3.9.1

minj added a commit to minj/js-yaml that referenced this pull request Apr 28, 2018
* master: (58 commits)
  Check for leading newlines when determining if block indentation indicator is needed (nodeca#404)
  Add property based tests to assess load reverses dump (nodeca#398)
  3.11.0 released
  Browser files rebuild
  Dumper: fix negative integers in bin/octal/hex formats, close nodeca#399
  support es6 arrow functions, fixes nodeca#389 (nodeca#393)
  Fix typo in README.md (nodeca#373)
  3.10.0 released
  Browser files rebuild
  Add test for astrals dump
  Combine surrogate pairs into one escape sequence when encoding. (nodeca#369)
  Fix condenseFlow for objects (nodeca#371)
  correct spelling mistake (nodeca#367)
  More meaningful error for loader (nodeca#361)
  Fix typo and format code. (nodeca#365)
  3.9.1 released
  Browser files rebuild
  Ensure stack is present for custom errors (fixes nodeca#351) (nodeca#360)
  3.9.0 released
  Browser files rebuild
  ...
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.

CLI no longer provides location of error
2 participants