Fix problems with propagating errors from workers to the main thread.

* Errors can not be posted directly.  Copy their properties into a plain object for transport.
* If postMessage fails, use formatError to provide a better string error message.