diff options
author | Yoshiya Hinosawa <stibium121@gmail.com> | 2023-11-29 15:42:58 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-29 15:42:58 +0900 |
commit | e332fa4a83d36605771844745738c001f276b390 (patch) | |
tree | 9d21beacdcad06bb49cc31539ed3d8374e27506f /ext/node/polyfills/internal/errors.ts | |
parent | 75ec650f080ac66e98d8b848118dc2349ca70aa8 (diff) |
fix(ext/node): add util.parseArgs (#21342)
Diffstat (limited to 'ext/node/polyfills/internal/errors.ts')
-rw-r--r-- | ext/node/polyfills/internal/errors.ts | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/ext/node/polyfills/internal/errors.ts b/ext/node/polyfills/internal/errors.ts index 7f7ce9d3a..8d10e1857 100644 --- a/ext/node/polyfills/internal/errors.ts +++ b/ext/node/polyfills/internal/errors.ts @@ -2472,6 +2472,36 @@ export class ERR_PACKAGE_PATH_NOT_EXPORTED extends NodeError { } } +export class ERR_PARSE_ARGS_INVALID_OPTION_VALUE extends NodeTypeError { + constructor(x: string) { + super("ERR_PARSE_ARGS_INVALID_OPTION_VALUE", x); + } +} + +export class ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL extends NodeTypeError { + constructor(x: string) { + super( + "ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL", + `Unexpected argument '${x}'. This ` + + `command does not take positional arguments`, + ); + } +} + +export class ERR_PARSE_ARGS_UNKNOWN_OPTION extends NodeTypeError { + constructor(option, allowPositionals) { + const suggestDashDash = allowPositionals + ? ". To specify a positional " + + "argument starting with a '-', place it at the end of the command after " + + `'--', as in '-- ${JSONStringify(option)}` + : ""; + super( + "ERR_PARSE_ARGS_UNKNOWN_OPTION", + `Unknown option '${option}'${suggestDashDash}`, + ); + } +} + export class ERR_INTERNAL_ASSERTION extends NodeError { constructor(message?: string) { const suffix = "This is caused by either a bug in Node.js " + |