From f6f84ac3f0150d04707090b8e56aea9c8d7ad4e0 Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Mon, 31 Jan 2022 04:30:29 -0700 Subject: [PATCH] fix: use InvalidArgumentError for commander errors InvalidOptionArgumentError was renamed to InvalidArgumentError in https://github.com/tj/commander.js/pull/1508 for commander@8.0.0. Signed-off-by: Kevin Locke --- cli.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cli.js b/cli.js index 49417eb..65bc126 100644 --- a/cli.js +++ b/cli.js @@ -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'); @@ -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}"`, ); } @@ -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;