Open aarondill opened 1 year ago
The error codes are set on the error.code
property. The errors are constructed the same way as other node errors, and there are not additional custom properties.
The codes used for author errors in the setup options are:
ERR_INVALID_ARG_TYPE
ERR_INVALID_ARG_VALUE
The codes used with errors detected when parsing cli arguments are:
ERR_PARSE_ARGS_INVALID_OPTION_VALUE
ERR_PARSE_ARGS_UNKNOWN_OPTION
ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL
Having investigated further the Node.js Error Documentation, these are documented there, but it would be helpful to have them also documented on the Util.parseArgs / the readme.
The documentation for
strict: true
says that it throws an error, but says nothing about the possible error.codes. Increased documentation would make displaying help and errors to users far easier to figure out, without relying on trial and error, or the separate Error documentation.