Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v7 doesn't work as described #31

Closed
goloroden opened this issue May 12, 2020 · 3 comments · Fixed by #32
Closed

v7 doesn't work as described #31

goloroden opened this issue May 12, 2020 · 3 comments · Fixed by #32

Comments

@goloroden
Copy link

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
Copy link
Owner

Technically, we only really need to do this for deserializeError. For serialize, we can make them enumerable.

// @Weakky

@goloroden
Copy link
Author

That would be awesome ❤️

@Weakky
Copy link
Contributor

Weakky commented May 12, 2020

Ah indeed, sorry for the inconvenience. Will take care of that shortly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants