File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 5
5
6
6
import * as fs from 'fs' ;
7
7
import * as path from 'path' ;
8
- import { QuickPickItem } from 'vscode' ;
8
+ import { commands , QuickPickItem , window } from 'vscode' ;
9
9
import { KubeConfig , findHomeDir , loadYaml } from '@kubernetes/client-node' ;
10
10
import { User , Cluster } from '@kubernetes/client-node/dist/config_types' ;
11
11
@@ -19,9 +19,14 @@ function fileExists(file: string): boolean {
19
19
}
20
20
21
21
export class KubeConfigUtils extends KubeConfig {
22
+ public readonly loadingError : any ;
22
23
constructor ( ) {
23
24
super ( ) ;
24
- this . loadFromDefault ( ) ;
25
+ try {
26
+ this . loadFromDefault ( ) ;
27
+ } catch ( error ) {
28
+ throw new Error ( 'Kubernetes configuration file cannot be parsed. Please open it in editor and fix the errors to continue.' ) ;
29
+ }
25
30
// k8s nodejs-client ignores all unknown properties,
26
31
// so cluster object's proxy-url attribute is not present
27
32
// after k8s config loaded
You can’t perform that action at this time.
0 commit comments