Skip to content

Commit

Permalink
Catch errors throw in
Browse files Browse the repository at this point in the history
  • Loading branch information
cqliu1 committed Nov 14, 2024
1 parent 4472792 commit be2ac8d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/plugins/ui_actions/public/actions/action_internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ export class ActionInternal<Context extends object = object>

public async isCompatible(context: Context): Promise<boolean> {
if (!this.definition.isCompatible) return true;
return await this.definition.isCompatible(context);
try {
return await this.definition.isCompatible(context);
} catch (e) {
// eslint-disable-next-line no-console
console.error(e);
return false;
}
}

public async getHref(context: Context): Promise<string | undefined> {
Expand Down

0 comments on commit be2ac8d

Please sign in to comment.