|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.2 KB
|
| Line | |
|---|
| 1 | // @ts-check
|
|---|
| 2 |
|
|---|
| 3 | /**
|
|---|
| 4 | * CommanderError class
|
|---|
| 5 | * @class
|
|---|
| 6 | */
|
|---|
| 7 | class CommanderError extends Error {
|
|---|
| 8 | /**
|
|---|
| 9 | * Constructs the CommanderError class
|
|---|
| 10 | * @param {number} exitCode suggested exit code which could be used with process.exit
|
|---|
| 11 | * @param {string} code an id string representing the error
|
|---|
| 12 | * @param {string} message human-readable description of the error
|
|---|
| 13 | * @constructor
|
|---|
| 14 | */
|
|---|
| 15 | constructor(exitCode, code, message) {
|
|---|
| 16 | super(message);
|
|---|
| 17 | // properly capture stack trace in Node.js
|
|---|
| 18 | Error.captureStackTrace(this, this.constructor);
|
|---|
| 19 | this.name = this.constructor.name;
|
|---|
| 20 | this.code = code;
|
|---|
| 21 | this.exitCode = exitCode;
|
|---|
| 22 | this.nestedError = undefined;
|
|---|
| 23 | }
|
|---|
| 24 | }
|
|---|
| 25 |
|
|---|
| 26 | /**
|
|---|
| 27 | * InvalidArgumentError class
|
|---|
| 28 | * @class
|
|---|
| 29 | */
|
|---|
| 30 | class InvalidArgumentError extends CommanderError {
|
|---|
| 31 | /**
|
|---|
| 32 | * Constructs the InvalidArgumentError class
|
|---|
| 33 | * @param {string} [message] explanation of why argument is invalid
|
|---|
| 34 | * @constructor
|
|---|
| 35 | */
|
|---|
| 36 | constructor(message) {
|
|---|
| 37 | super(1, 'commander.invalidArgument', message);
|
|---|
| 38 | // properly capture stack trace in Node.js
|
|---|
| 39 | Error.captureStackTrace(this, this.constructor);
|
|---|
| 40 | this.name = this.constructor.name;
|
|---|
| 41 | }
|
|---|
| 42 | }
|
|---|
| 43 |
|
|---|
| 44 | exports.CommanderError = CommanderError;
|
|---|
| 45 | exports.InvalidArgumentError = InvalidArgumentError;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.