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() {
if (this.options.fallbackApiBases) {
return this.getLatestApiPrefixGroup();
} else {
return {
apiPrefix: this.apiPrefix,
apiGroup: this.apiGroup
};
try {
return await this.getLatestApiPrefixGroup();
} catch (error) {
// If valid API wasn't found, log the error and return defaults below
console.error(error);
}
}
return {
apiPrefix: this.apiPrefix,
apiGroup: this.apiGroup
};
}
protected async checkPreferredVersion() {