Fix the exception propagation when rejecting workerReadyCapability

Currently when an exception is thrown, we try to reject `workerReadyCapability` with multiple arguments in src/core/api.js. This obviously doesn't work, hence this PR changes that to instead reject with the exception object as is.
In src/core/worker.js the exception is currently (unncessarily) wrapped in an object, so this patch also simplifies that to directly send the exception object instead.

Also, this PR adds a unit test to check that the exception handling is working as expected (it fails with the current `master`).

**Note:** Two commits were extracted from PR #5234, since I think it makes sense to get the exception handling fixed as soon as possible!