镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

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

Description

@aarondill

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.

Activity

  1. shadowspawn commented on Feb 3, 2023

    @shadowspawn
    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
    
  2. aarondill commented on Feb 4, 2023

    @aarondill
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions