This repository was archived by the owner on Apr 22, 2023. It is now read-only.
assert: use util.inspect() to create error messages#8734
Closed
cjihrig wants to merge 1 commit intonodejs:v0.12from
cjihrig:8696
Closed
assert: use util.inspect() to create error messages#8734cjihrig wants to merge 1 commit intonodejs:v0.12from cjihrig:8696
cjihrig wants to merge 1 commit intonodejs:v0.12from
cjihrig:8696
Conversation
Currently, JSON.stringify() is used to create error messages on failed assertions. This causes an error when stringifying objects with circular references. This commit switches out JSON.stringify() for util.inspect(), which can handle circular references.
|
This is a good idea. +1 |
|
LGTM, thanks @cjihrig! |
misterdjules
pushed a commit
to misterdjules/node
that referenced
this pull request
Jan 29, 2015
Currently, JSON.stringify() is used to create error messages on failed assertions. This causes an error when stringifying objects with circular references. This commit switches out JSON.stringify() for util.inspect(), which can handle circular references. PR: nodejs#8734 PR-URL: nodejs#8734 Reviewed-By: Julien Gilli <julien.gilli@joyent.com>
|
All tests pass (unsurprisingly), landed in bcff90e. |
|
@cjihrig Would be good to land this in io.js as well. |
Author
|
@piscisaureus this could be considered a breaking change. Thoughts on that? |
|
I would agree |
|
@cjihrig Semver-minor? The merge window for 1.1 is open. |
Author
|
@piscisaureus I would say semver-major because perfectly valid programs could stop working if they were doing any string matching on the output. I'll open a PR over there and see what others say. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Currently,
JSON.stringify()is used to create error messages on failed assertions. This causes an error when stringifying objects with circular references. This commit switches outJSON.stringify()forutil.inspect(), which can handle circular references.Closes #8696