Skip to content

Catch JSON stringily errors.#195

Merged
thebigredgeek merged 1 commit intodebug-js:masterfrom
jalleyne:master
Nov 14, 2016
Merged

Catch JSON stringily errors.#195
thebigredgeek merged 1 commit intodebug-js:masterfrom
jalleyne:master

Conversation

@jalleyne
Copy link
Copy Markdown
Contributor

@jalleyne jalleyne commented Apr 8, 2015

There is a chance that there may be circular references in the Object which will cause the debug message to throw an exception. If the exception is not handled on the application level this will cause node to crash. As a debug library, errors in here should not have such a serious impact on the application.

There is a chance that there may be circular references in the Object which will cause the debug message to throw an exception. If the exception is not handled on the application level this will cause node to crash. As a debug library, errors in here should not have such a serious impact on the application.
@stephenmathieson
Copy link
Copy Markdown
Contributor

imo, this falls out of scope for this module.. see what nate says though

@jalleyne
Copy link
Copy Markdown
Contributor Author

jalleyne commented Apr 9, 2015

Completely agree that argument validation is out of scope, but dont think its a good idea that debug code can throw unexpected errors. This is sort of an odd case.

@ronkorving
Copy link
Copy Markdown

Since it's debug doing the stringify operation, it's its responsibility not to throw. Node.js's own console.log deals with this gracefully by mentioning circular references explicitly. I think that's the only correct way to deal with this.

@jalleyne
Copy link
Copy Markdown
Contributor Author

Any updates/ further thoughts on this?

@world
Copy link
Copy Markdown

world commented May 30, 2016

I haven't had this happen yet but would be worried if node crashed from debug.

@TooTallNate
Copy link
Copy Markdown
Contributor

👍

@thebigredgeek
Copy link
Copy Markdown
Contributor

Looks good to me! Merging

@thebigredgeek thebigredgeek added bug This issue identifies a malfunction change-patch This proposes or provides a change that requires a patch release labels Nov 14, 2016
@thebigredgeek thebigredgeek merged commit 3491ad6 into debug-js:master Nov 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug This issue identifies a malfunction change-patch This proposes or provides a change that requires a patch release

Development

Successfully merging this pull request may close these issues.

6 participants