Handle errors from getLatestApiPrefixGroup.

Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
Panu Horsmalahti committed 2020-11-30 14:09:29 +02:00
1 parent 07e6df9fdc
commit a6ebcfab4e
1 file changed
+8 -3
+8 -3
View File
@@ -173,14 +173,19 @@ export class KubeApi<T extends KubeObject = any> {
*/
private async getPreferredVersionPrefixGroup() {
if (this.options.fallbackApiBases) {
return this.getLatestApiPrefixGroup();
} else {
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() {
if (this.options.fallbackApiBases && !this.options.checkPreferredVersion) {