enhancementhelp wanted
Description
An issue I found when throwing deserialized errors is that the thrown error has no reference to this throw point.
I think the "correct" way to throw serialized errors would be something like:
throw new Error(serialized.message, {
cause: deserializeError(serialized),
});
Two drawbacks:
new Errordoesn't benefit from https://github.com/sindresorhus/serialize-error/pull/70- this isn't necessarily what people want or expect by default
So how about:
throw deserializeError(serialized, {preserveStack: true});