Sha256: c69bbc276b3c7fec052f930b9de091db2206646761f765a2077d5731f763dc55

Contents?: true

Size: 1.21 KB

Versions: 35

Compression:

Stored size: 1.21 KB

Contents

// @ts-check

/**
 * CommanderError class
 * @class
 */
class CommanderError extends Error {
  /**
   * Constructs the CommanderError class
   * @param {number} exitCode suggested exit code which could be used with process.exit
   * @param {string} code an id string representing the error
   * @param {string} message human-readable description of the error
   * @constructor
   */
  constructor(exitCode, code, message) {
    super(message);
    // properly capture stack trace in Node.js
    Error.captureStackTrace(this, this.constructor);
    this.name = this.constructor.name;
    this.code = code;
    this.exitCode = exitCode;
    this.nestedError = undefined;
  }
}

/**
 * InvalidArgumentError class
 * @class
 */
class InvalidArgumentError extends CommanderError {
  /**
   * Constructs the InvalidArgumentError class
   * @param {string} [message] explanation of why argument is invalid
   * @constructor
   */
  constructor(message) {
    super(1, 'commander.invalidArgument', message);
    // properly capture stack trace in Node.js
    Error.captureStackTrace(this, this.constructor);
    this.name = this.constructor.name;
  }
}

exports.CommanderError = CommanderError;
exports.InvalidArgumentError = InvalidArgumentError;

Version data entries

35 entries across 35 versions & 2 rubygems

Version Path
immosquare-cleaner-0.1.60 node_modules/commander/lib/error.js
immosquare-cleaner-0.1.59 node_modules/commander/lib/error.js
immosquare-cleaner-0.1.58 node_modules/commander/lib/error.js
immosquare-cleaner-0.1.57 node_modules/commander/lib/error.js
immosquare-cleaner-0.1.56 node_modules/commander/lib/error.js
immosquare-cleaner-0.1.55 node_modules/commander/lib/error.js
immosquare-cleaner-0.1.54 node_modules/commander/lib/error.js
immosquare-cleaner-0.1.53 node_modules/commander/lib/error.js
immosquare-cleaner-0.1.52 node_modules/commander/lib/error.js
immosquare-cleaner-0.1.51 node_modules/commander/lib/error.js
immosquare-cleaner-0.1.50 node_modules/commander/lib/error.js
immosquare-cleaner-0.1.49 node_modules/commander/lib/error.js
immosquare-cleaner-0.1.48 node_modules/commander/lib/error.js
immosquare-cleaner-0.1.47 node_modules/commander/lib/error.js
immosquare-cleaner-0.1.46 node_modules/commander/lib/error.js
immosquare-cleaner-0.1.45 node_modules/commander/lib/error.js
immosquare-cleaner-0.1.44 node_modules/commander/lib/error.js
immosquare-cleaner-0.1.43 node_modules/commander/lib/error.js
immosquare-cleaner-0.1.42 node_modules/commander/lib/error.js
immosquare-cleaner-0.1.41 node_modules/commander/lib/error.js