Skip to content

Commit

Permalink
fix: use InvalidArgumentError for commander errors
Browse files Browse the repository at this point in the history
InvalidOptionArgumentError was renamed to InvalidArgumentError in
tj/commander.js#1508 for commander@8.0.0.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
  • Loading branch information
kevinoid committed Jan 31, 2022
1 parent 26aec42 commit aa7e251
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cli.js
Expand Up @@ -6,7 +6,7 @@

import {
Command,
InvalidOptionArgumentError,
InvalidArgumentError,
Option,
} from 'commander';

Expand All @@ -25,11 +25,11 @@ function coerceWait(arg) {
// Note: Don't treat '' as 0 (no wait), since it's more likely user error
const val = Number(arg);
if (arg === '' || Number.isNaN(val)) {
throw new InvalidOptionArgumentError(`Invalid number "${arg}"`);
throw new InvalidArgumentError(`Invalid number "${arg}"`);
}

if (val < 0) {
throw new InvalidOptionArgumentError('--wait must not be negative');
throw new InvalidArgumentError('--wait must not be negative');
}

return val;
Expand Down Expand Up @@ -137,7 +137,7 @@ export default async function hubCiStatusMain(args, options) {

// If a non-Commander error was thrown, treat it as unhandled.
// It probably represents a bug and has not been written to stdout/stderr.
// throw commander.{CommanderError,InvalidOptionArgumentError} to avoid.
// throw commander.{CommanderError,InvalidArgumentError} to avoid.
if (typeof errParse.code !== 'string'
|| !errParse.code.startsWith('commander.')) {
throw errParse;
Expand Down

0 comments on commit aa7e251

Please sign in to comment.