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

Working with errors #22

Open
maciej-sielski opened this issue Mar 11, 2021 · 2 comments
Open

Working with errors #22

maciej-sielski opened this issue Mar 11, 2021 · 2 comments

Comments

@maciej-sielski
Copy link

Hi guys,
I have a problem with copying objects that contain Error objects. serializing Error causes to completely loosing its properties.

When you look at cloneProto function I think you could change the for clause to fetch property names

const props = Object.getOwnPropertyNames(o);
for (const k of props) {

We loose name but at least we have message and stack. What do you think?

@maciej-sielski
Copy link
Author

Please excuse my ignorance. for in has to stay in order to iterate over object's prototype properties. So the question remaining is can we ADD iteration over Object.getOwnPropertyNames(o); ?

@titanism
Copy link

Hi there @maciej-sielski, you could use parse-err package for Errors. See https://www.npmjs.com/package/parse-err and https://github.com/cabinjs/parse-err

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

No branches or pull requests

2 participants