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 8a22b8e commit f6f84ac
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cli.js
Expand Up @@ -6,7 +6,7 @@

'use strict';

const { Command, InvalidOptionArgumentError } = require('commander');
const { Command, InvalidArgumentError } = require('commander');
const { promisify } = require('util');

const packageJson = require('./package.json');
Expand Down Expand Up @@ -39,7 +39,7 @@ function headerOption(headerLine, headers = Object.create(null)) {
// as a convenience for users.
const match = /^\s*(\S+)\s*: ?(.*)$/.exec(headerLine);
if (!match) {
throw new InvalidOptionArgumentError(
throw new InvalidArgumentError(
`Header must start with token, then colon. Got "${headerLine}"`,
);
}
Expand Down Expand Up @@ -199,7 +199,7 @@ async function swaggerSpecValidatorCmd(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 f6f84ac

Please sign in to comment.