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,14 +173,19 @@ 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();
} catch (error) {
// If valid API wasn't found, log the error and return defaults below
console.error(error);
}
}
return { return {
apiPrefix: this.apiPrefix, apiPrefix: this.apiPrefix,
apiGroup: this.apiGroup apiGroup: this.apiGroup
}; };
} }
}
protected async checkPreferredVersion() { protected async checkPreferredVersion() {
if (this.options.fallbackApiBases && !this.options.checkPreferredVersion) { if (this.options.fallbackApiBases && !this.options.checkPreferredVersion) {