error-replacer
v1.0.0
Published
A 'replacer' function for JSON.stringify that turns errors into something meaningful
Downloads
4
Readme
error-replacer
Drop this into the replacer
argument in JSON.stringify and you will get meaningful JSON serialization of Error objects.
const errorReplacer = require('error-replacer');
// basicsOnly - say true (default) if you only want Error type and message, no stack or file details
JSON.stringify(something, errorReplacer(basicsOnly));