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 8ee697d commit 5ca0713
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cli.js
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
Expand All @@ -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}`,
);
}
Expand Down

0 comments on commit 5ca0713

Please sign in to comment.