diff --git a/src/plugins/ui_actions/public/actions/action_internal.ts b/src/plugins/ui_actions/public/actions/action_internal.ts index ccef920ecc465..6f979849bdc41 100644 --- a/src/plugins/ui_actions/public/actions/action_internal.ts +++ b/src/plugins/ui_actions/public/actions/action_internal.ts @@ -29,6 +29,7 @@ export class ActionInternal public readonly subscribeToCompatibilityChanges?: Action['subscribeToCompatibilityChanges']; public readonly couldBecomeCompatible?: Action['couldBecomeCompatible']; + public errorLogged?: boolean; constructor(public readonly definition: ActionDefinition) { this.id = this.definition.id; @@ -38,6 +39,7 @@ export class ActionInternal this.grouping = this.definition.grouping; this.showNotification = this.definition.showNotification; this.disabled = this.definition.disabled; + this.errorLogged = false; if (this.definition.subscribeToCompatibilityChanges) { this.subscribeToCompatibilityChanges = definition.subscribeToCompatibilityChanges; @@ -77,7 +79,16 @@ export class ActionInternal public async isCompatible(context: Context): Promise { if (!this.definition.isCompatible) return true; - return await this.definition.isCompatible(context); + try { + return await this.definition.isCompatible(context); + } catch (e) { + if (!this.errorLogged) { + // eslint-disable-next-line no-console + console.error(e); + this.errorLogged = true; + } + return false; + } } public async getHref(context: Context): Promise {