-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
assert: use util.inspect() to create error messages #668
Conversation
That would be my suggestion. I'm +1 on this patch. I think the biggest question is whether this is semver-major or minor. I think this is a minimal behavioral change for which a minor version bump is appropriate. |
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.
I'm in favor of semver patch here: it's not new "behavior" – in the form of a new API method or parameter, and doesn't change the contract – trying to JSON.parse will still explode, just more often now :) I'm also +1 on this patch. |
I have updated the PR. Since the window is currently open for a minor version, I'll land this tomorrow if no one protests. |
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-URL: #668 Reviewed-By: Julien Gilli <julien.gilli@joyent.com> Reviewed-By: Bert Belder <bertbelder@gmail.com> Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Landed in 40e29dc |
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.This is a port of nodejs/node-v0.x-archive#8734. The main question here is about semver labeling.
cc: @piscisaureus