mindstudio
Version:
Client library for MindStudio AI Workers
32 lines (31 loc) ⢠1.3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseCommand = void 0;
const errors_1 = require("../../errors");
class BaseCommand {
logDebug(message, options) {
if (options === null || options === void 0 ? void 0 : options.verbose) {
console.log(`š Debug: ${message}`);
}
}
logError(error, message, options) {
if (error instanceof errors_1.MindStudioError) {
console.error(`\nā ${message}:` +
`\n ${error.message}` +
((options === null || options === void 0 ? void 0 : options.verbose)
? `\n Code: ${error.code}` +
`\n Status: ${error.status}` +
(error.details
? `\n Details: ${JSON.stringify(error.details, null, 2)}`
: "")
: ""));
}
else {
console.error(`\nā ${message}:` +
((options === null || options === void 0 ? void 0 : options.verbose)
? `\n ${error instanceof Error ? error.stack : String(error)}`
: `\n ${error instanceof Error ? error.message : String(error)}`));
}
}
}
exports.BaseCommand = BaseCommand;