ern-api-gen
Version:
Electrode Native API generator
20 lines • 717 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const CliError_1 = require("./CliError");
class CommandErrorHandler {
constructor(values, opts, cmd) {
this.values = values;
this.opts = opts;
this.cmd = cmd;
}
handle(message) {
if (this.opts.commandUsage && this.opts && this.cmd) {
const help = new this.opts.commandUsage(this.values, this.opts, this.cmd);
const helpMesg = help.run();
throw new CliError_1.CliError(`${message}\n${helpMesg}`);
}
throw new CliError_1.CliError(message);
}
}
exports.CommandErrorHandler = CommandErrorHandler;
//# sourceMappingURL=CommandErrorHandler.js.map