@amplitude/ampli
Version:
Amplitude CLI
24 lines (23 loc) • 1.19 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SettingsLoadErrorCode = void 0;
const BaseCommandError_1 = require("./BaseCommandError");
const index_1 = require("./index");
var SettingsLoadErrorCode;
(function (SettingsLoadErrorCode) {
SettingsLoadErrorCode[SettingsLoadErrorCode["UNHANDLED_EXCEPTION"] = 0] = "UNHANDLED_EXCEPTION";
SettingsLoadErrorCode[SettingsLoadErrorCode["MERGE_CONFLICTS"] = 1] = "MERGE_CONFLICTS";
})(SettingsLoadErrorCode = exports.SettingsLoadErrorCode || (exports.SettingsLoadErrorCode = {}));
class SettingsLoadError extends BaseCommandError_1.default {
constructor(code) {
super(`Error loading settings from file. Error code: ${code}`);
this.name = 'SettingsLoadError';
this.code = code;
}
toUserFixableError(configPath, command) {
return (this.code === SettingsLoadErrorCode.MERGE_CONFLICTS)
? new index_1.UserFixableError(index_1.USER_ERROR_MESSAGES.settingsContainMergeConflict(configPath))
: new index_1.UserFixableError(index_1.USER_ERROR_MESSAGES.settingsFailedToLoad(configPath, command));
}
}
exports.default = SettingsLoadError;