util: improve internal `isError()` validation
The current internal isError function checked the toString value
instead of using the more precise util.types.isNativeError()
check.
The instanceof
check is not removed due to possible errors that
are not native but still an instance of Error.
The internal isError
function is only used in util.inspect()
and the repl
.
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