How to use the @zowe/imperative.ImperativeError function in @zowe/imperative

To help you get started, we’ve selected a few @zowe/imperative examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github IBM / zowe-cli-cics-deploy-plugin / __tests__ / __src__ / environment / TestEnvironment.ts View on Github external
private static async installPlugin(testEnvironment: ITestEnvironment) {
        let installScript: string = TemporaryScripts.SHEBANG;
        installScript += TemporaryScripts.ZOWE_BIN + " plugins install ../../../../\n"; // install plugin from root of project
        installScript += TemporaryScripts.ZOWE_BIN + " plugins validate @brightside/zowe-cli-cics-deploy-plugin\n";
        installScript += TemporaryScripts.ZOWE_BIN + " cdep --help\n"; // check that the plugin help is available
        const scriptPath = testEnvironment.workingDir + "/install_plugin.sh";
        IO.writeFile(scriptPath, Buffer.from(installScript));

        const output = runCliScript(scriptPath, testEnvironment, []);

        if (output.status !== 0) {
            throw new ImperativeError({
                msg: "Install of '@brightside/zowe-cli-cics-deploy-plugin' plugin failed! You should delete the script: \n'" + scriptPath + "' " +
                    "after reviewing it to check for possible errors.\n Output of the plugin install command:\n" + output.stderr.toString() +
                    output.stdout.toString()
            });
        }
        IO.deleteFile(scriptPath);
    }
github IBM / zowe-cli-cics-deploy-plugin / src / api / BundlePush / SubtaskWithStatus.ts View on Github external
constructor(parent: ITaskWithStatus, ticks: number) {
        this.parent = parent;
        this.ticks = ticks;
        this.percentCompleteInternal = 0;
        if (this.ticks < 0 || this.ticks > TaskProgress.ONE_HUNDRED_PERCENT) {
            throw new ImperativeError({msg: "Ticks must be between 0 and 100"});
        }
    }