[v12.x backport] events: allow monitoring error events
Backport https://github.com/nodejs/node/pull/30932 to v12 as it was reverted in 12.16.1 (see https://github.com/nodejs/node/pull/30932#issuecomment-587233501).
To avoid the issue seen in 12.16.0 I added the changes from https://github.com/nodejs/node/pull/31848 on top.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines