Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

output a warning if attempting to stringify something that is dropped #1691

Closed
wants to merge 1 commit into from
Closed

output a warning if attempting to stringify something that is dropped #1691

wants to merge 1 commit into from

Conversation

AD7six
Copy link

@AD7six AD7six commented Sep 13, 2011

See issue #1665 for related discussion

@felixge
Copy link

felixge commented Sep 13, 2011

Not sure if that's desirable. It should either be an error (throwing) or silently ignored. Just like JSON.stringify() will silently drop functions, but throw on circular objects.

In this case the silent ignoring currently in place seems to make most sense so.

@AD7six
Copy link
Author

AD7six commented Sep 13, 2011

the existing behavior is to silently drop objects and arrays - if bc isn't a concern, throwing an error is more approprioate; but silently dropping potentially big chunks of data is surely something the user should be notified about. ciirular references and functions are not really valid comparisons imo.

@felixge
Copy link

felixge commented Sep 13, 2011

In that case I'd propose to coerce these types into strings (value + ''). That will leave users the choice to implement toString() methods for their custom objects, while producing outputs that show what happened by default. Either way, warnings are annoying.

@liangzan
Copy link

I was just caught by this behaviour. Would it help If I send in a patch that coerce objects and arrays into a string as you suggested?

@AD7six AD7six closed this Sep 6, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants