resolve review comments

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2020-11-26 09:19:09 -05:00
1 parent b3a01fac2f
commit 7fadcda642
2 files changed
+8 -5

No files matched your search

+3 -1
View File
@@ -21,7 +21,9 @@ module.exports = {
sourceType: 'module',
},
rules: {
"indent": ["error", 2],
"indent": ["error", 2, {
"SwitchCase": 1,
}],
"no-unused-vars": "off",
"semi": ["error", "always"],
"object-shorthand": "error",
+5 -4
View File
@@ -28,7 +28,7 @@ export class AccessError extends LoadKubeError {
}
toString() {
return `Failed to loading the kube config. Permission denied.\n\n${this.pathname}`;
return `Failed loading the kube config. Permission denied.\n\n${this.pathname}`;
}
}
@@ -40,18 +40,19 @@ export class ExistError extends LoadKubeError {
}
toString() {
return `Failed to loading the kube config. No such file.\n\n${this.pathname}`;
return `Failed loading the kube config. No such file.\n\n${this.pathname}`;
}
}
export function loadConfig(pathOrContent: string): KubeConfig {
const kc = new KubeConfig();
const pathVersion = resolveTilde(pathOrContent);
try {
kc.loadFromFile(pathOrContent);
kc.loadFromFile(pathVersion);
} catch (err) {
switch (err.code) {
case "ENOENT": { // No such file or directory
const dir = path.dirname(pathOrContent);
const dir = path.dirname(pathVersion);
const dirStat = fse.statSync(dir);
if (dirStat.isDirectory()) {
throw new ExistError(pathOrContent);