debitoor / safe-json-stringify

A wrapper for JSON.stringify that handles circular references and prevent defined getters from throwing errors.
https://www.npmjs.com/package/safe-json-stringify
56 stars 16 forks source link

Unable to stringify exceptions #9

Closed binarykitchen closed 4 years ago

binarykitchen commented 6 years ago

Found out while debugging that your library can't stringify exceptions.

For example DOMException: The play() request was interrupted by a call to pause() gets returned as {}.

ronkorving commented 4 years ago

That's a DOMException, which probably also serializes to {} when simply using JSON.stringify, I assume? In which case, I would imagine it's kind of out-of-scope for this library. Error objects don't get any special treatment in this library, they're treated like any other object.

binarykitchen commented 4 years ago

alright then