From 5ca0713b6ef1606b26f58199785b65ecccf8064e Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Mon, 31 Jan 2022 04:22:26 -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 789fa6d..c7295aa 100644 --- a/cli.js +++ b/cli.js @@ -4,7 +4,7 @@ * @module "noderegression/cli.js" */ -import { Command, InvalidOptionArgumentError } from 'commander'; +import { Command, InvalidArgumentError } from 'commander'; import fetch from 'node-fetch'; // TODO [engine:node@>=14]: import { readFile } from 'fs/promises' import { createWriteStream, promises as fsPromises } from 'fs'; @@ -58,7 +58,7 @@ function parseDate(str) { let date = new Date(str); const dateMs = date.getTime(); if (Number.isNaN(dateMs)) { - throw new InvalidOptionArgumentError(`Invalid Date: ${str}`); + throw new InvalidArgumentError(`Invalid Date: ${str}`); } const dayMs = dateMs % (24 * 60 * 60 * 1000); @@ -69,7 +69,7 @@ function parseDate(str) { // (e.g. 'YYYY-MM-DD' parsed as UTC, 'MM/DD/YYYY' parsed as local time) // Build time is not known (currently treated as midnight UTC, which // may not match user expectations). - throw new InvalidOptionArgumentError( + throw new InvalidArgumentError( `Date with time not supported: ${str}`, ); }