Closed samuelt1 closed 4 years ago
Yes, using a custom replacer would be the best approach here. The goal is to replicate JavaScript as closely as possible, so the current behavior is preferable. Anywhere you'd want to deviate from outputting JavaScript you should override.
The following:
stringifies like so:
"new Error('problem')"
I was hoping it would stringify something more like:
'{"message":"problem","stack":"Error: hi\nat <anonymous>:1:5 [<root>]","name":"Error"}'
I overcame this using custom replacers, which might be the only real solution seeing as how widely used this package is: