Not 100% how portable this is, but I think we might be able to serialize/deserialize errors like so:
class FrozenError extends Error {
constructor (msg, stack) {
super(msg);
this.stack = stack;
}
}
new FrozenError(realerror.message, realerror.stack);