Working with errors
maciej-sielski opened this issue · comments
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?
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);
?
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