[v8.x backport] errors: make code property mutable#16078
Closed
Trott wants to merge 2 commits intonodejs:v8.x-stagingfrom
Closed
[v8.x backport] errors: make code property mutable#16078Trott wants to merge 2 commits intonodejs:v8.x-stagingfrom
Trott wants to merge 2 commits intonodejs:v8.x-stagingfrom
Conversation
3 tasks
9eb991a to
6f42b68
Compare
jasnell
approved these changes
Oct 12, 2017
Member
jasnell
left a comment
There was a problem hiding this comment.
but definitely needs a rebase following 8.7.0
Userland code can break if it depends on a mutable `code` property for errors. Allow users to change the `code` property but do not propagate changes to the error `name`. Additionally, make `message` and `name` consistent with `Error` object (non-enumerable). Test that `console.log()` and `.toString()` calls on internal `Error` objects with mutated properties have analogous results with the standard ECMAScript `Error` objects. PR-URL: nodejs#15694 Fixes: nodejs#15658 Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
For internal errors, make `code` and `name` settable while keeping them non-own properties by default. PR-URL: nodejs#15694 Fixes: nodejs#15658 Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Member
Author
|
Rebased. |
Contributor
evanlucas
pushed a commit
that referenced
this pull request
Oct 23, 2017
Userland code can break if it depends on a mutable `code` property for errors. Allow users to change the `code` property but do not propagate changes to the error `name`. Additionally, make `message` and `name` consistent with `Error` object (non-enumerable). Test that `console.log()` and `.toString()` calls on internal `Error` objects with mutated properties have analogous results with the standard ECMAScript `Error` objects. Backport-PR-URL: #16078 PR-URL: #15694 Fixes: #15658 Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
evanlucas
pushed a commit
that referenced
this pull request
Oct 23, 2017
For internal errors, make `code` and `name` settable while keeping them non-own properties by default. Backport-PR-URL: #16078 PR-URL: #15694 Fixes: #15658 Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Userland code can break if it depends on a mutable
codeproperty forerrors. Allow users to change the
codeproperty but do not propagatechanges to the error
name.Additionally, make
messageandnameconsistent withErrorobject(non-enumerable). Test that
console.log()and.toString()calls oninternal
Errorobjects with mutated properties have analogous resultswith the standard ECMAScript
Errorobjects.Fixes: #15658
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
errors