v7 doesn't work as described
Closed this issue ยท 3 comments
goloroden commented
The breaking change in v7 turned the example from the README.md
useless:
const {serializeError, deserializeError} = require('serialize-error');
const error = new Error('๐ฆ');
console.log(error);
//=> [Error: ๐ฆ]
const serialized = serializeError(error)
console.log(serialized);
//=> {name: 'Error', message: '๐ฆ', stack: 'Error: ๐ฆ\n at Object.<anonymous> โฆ'}
const deserialized = deserializeError(serialized);
//=> [Error: ๐ฆ]
The serialized error looks just like an empty object now, and is missing the name
, message
, and stack
properties on the console. Actually, for me this was the most useful feature, and hence v7 is a huge step into the wrong direction.
I understand that you wanted to change it this way to keep things consistent โ however, is there a chance to make this configurable?
sindresorhus commented
Technically, we only really need to do this for deserializeError
. For serialize, we can make them enumerable.
// @Weakky
goloroden commented
That would be awesome โค๏ธ
Weakky commented
Ah indeed, sorry for the inconvenience. Will take care of that shortly