1 | // @ts-check
|
2 |
|
3 | /**
|
4 | * A CLI error. Useful for anticipated CLI errors (such as invalid CLI
|
5 | * arguments) that don’t need to be displayed with a stack trace, vs unexpected
|
6 | * internal errors.
|
7 | */
|
8 | export default class CliError extends Error {
|
9 | /** @param {string} message Error message. */
|
10 | constructor(message) {
|
11 | if (typeof message !== "string")
|
12 | throw new TypeError("Argument 1 `message` must be a string.");
|
13 |
|
14 | super(message);
|
15 |
|
16 | this.name = this.constructor.name;
|
17 | }
|
18 | }
|