fix: Unseen error on client action execution

This commit is contained in:
Tom Moor
2024-02-06 19:08:05 -05:00
parent 0ff0780869
commit 7bf403356a
2 changed files with 10 additions and 4 deletions

View File

@@ -119,7 +119,13 @@ export function actionToKBar(
}
export async function performAction(action: Action, context: ActionContext) {
return action.perform?.(context)?.catch((err: Error) => {
toast.error(err.message);
});
const result = action.perform?.(context);
if (result instanceof Promise) {
return result.catch((err: Error) => {
toast.error(err.message);
});
}
return result;
}