1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Handle errors from getLatestApiPrefixGroup.

Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
Panu Horsmalahti 2020-11-30 14:09:29 +02:00
parent 07e6df9fdc
commit a6ebcfab4e

View File

@ -173,13 +173,18 @@ export class KubeApi<T extends KubeObject = any> {
*/ */
private async getPreferredVersionPrefixGroup() { private async getPreferredVersionPrefixGroup() {
if (this.options.fallbackApiBases) { if (this.options.fallbackApiBases) {
return this.getLatestApiPrefixGroup(); try {
} else { return await this.getLatestApiPrefixGroup();
return { } catch (error) {
apiPrefix: this.apiPrefix, // If valid API wasn't found, log the error and return defaults below
apiGroup: this.apiGroup console.error(error);
}; }
} }
return {
apiPrefix: this.apiPrefix,
apiGroup: this.apiGroup
};
} }
protected async checkPreferredVersion() { protected async checkPreferredVersion() {