Created by: nightpool
This is a followup to #894 that fixes #985 (closed) (prematurely closed because the reporter fixed the issue on a fork).
the rationale here:
the subprocess will always bubble up a JSON-serialized representation of an Error object, and we use err.message to maintain the same behavior from #894. Because we have no way of knowing what specific type this error was or even guarantee that we'd have access to that constructor (it may be a library or function that lives only in the child process), we need to create a normal Error object. However, we can use the properties that are bubbled up, including stack, message, code, etc, so we Object.assign them.