worker: use correct ctor for error serialization
When serializing errors, use the error constructor that is closest to the object itself in the prototype chain.
The previous practice of walking downwards meant that
Error
would usually be the first constructor that is used,
even when a more specific one would be available/appropriate,
because it is the base class of the other common error types.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines