Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: better documentation of errors thrown on strict: true #148

Open
aarondill opened this issue Feb 2, 2023 · 2 comments
Open

docs: better documentation of errors thrown on strict: true #148

aarondill opened this issue Feb 2, 2023 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@aarondill
Copy link

aarondill commented Feb 2, 2023

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.

@shadowspawn shadowspawn added the documentation Improvements or additions to documentation label Feb 3, 2023
@shadowspawn
Copy link
Collaborator

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

@aarondill
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants