src: fix error message in async_hooks constructor
There are two minor issues in the AsyncHook constructor, if the object passed in has an after and/or destroy property that are not functions the errors thrown will still be:
TypeError [ERR_ASYNC_CALLBACK]: before must be a function
This commit updates the code and adds a unit test.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines
Affected core subsystem(s)
src