UNPKG

@zowe/imperative

Version:
108 lines 2.81 kB
"use strict"; /* * This program and the accompanying materials are made available under the terms of the * Eclipse Public License v2.0 which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-v20.html * * SPDX-License-Identifier: EPL-2.0 * * Copyright Contributors to the Zowe Project. * */ Object.defineProperty(exports, "__esModule", { value: true }); exports.ImperativeError = void 0; /** * * @export * @class ImperativeError * @extends {Error} */ class ImperativeError extends Error { /** * Construct the Imperative error object. Contains the defaults of the error and optionally captures diagnostics * and other information. * @param {IImperativeError} details - the error details and text (stack, messages, etc.) * @param {IImperativeErrorParms} parms - control parameters to indicate logging of node-report and more */ constructor(mDetails, parms) { super(); this.mDetails = mDetails; this.mMessage = mDetails.msg; /** * If parms are present, handle them, otherwise perform the default diagnostic collection */ if (parms) { /** * Append a tag if present */ if (parms.tag) { this.mMessage = parms.tag + ": " + this.mMessage; } } } /** * Return causeErrors * @readonly * @type {any[]} * @memberof ImperativeError */ get causeErrors() { return this.mDetails.causeErrors; } /** * Return additionalDetails * @readonly * @type {string} * @memberof ImperativeError */ get additionalDetails() { return this.mDetails.additionalDetails; } /** * Return IImperativeError object * @readonly * @type {IImperativeError} * @memberof ImperativeError */ get details() { return this.mDetails; } /** * Return errorCode * @readonly * @type {string} * @memberof ImperativeError */ get errorCode() { return this.mDetails.errorCode; } /** * Return whether or not the error dump should be suppressed * @readonly * @type {string} * @memberof ImperativeError */ get suppressDump() { return this.mDetails.suppressDump; } /** * Return stack info * @readonly * @type {string} * @memberof ImperativeError */ get stack() { return this.mDetails.stack; } /** * Accessor for the error message. * @readonly * @return {string}: The error message * @memberof ImperativeError */ get message() { return this.mMessage; } } exports.ImperativeError = ImperativeError; //# sourceMappingURL=ImperativeError.js.map