Skip to content

process: fix error message of hrtime()

process.hrtime() incorrectly passes the function name to errors.TypeError instead of the name of the argument.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

process


I briefly discussed this with @addaleax. We assume that process.hrtime was passed to errors.TypeError due to the fact that it is easier to understand than the name of the parameter (time). I would still opt for consistency within our codebase and error messages, therefore this PR.

To be honest, most error messages of this type are relatively useless without the stack as we never include the function name in the message itself. We could add an argument to ERR_INVALID_ARG_TYPE which allows to specify the function, but that would make the error messages longer.

As always, needs to be approved by @nodejs/ctc.

Merge request reports

Loading