in packages/bonito-ui/src/components/form/action-form.tsx [159:195]
onClick: async () => {
setSubmitting(true);
try {
const { success, error } = await action.execute(
action.form.values
);
if (success) {
if (onExecuteSucceeded) {
onExecuteSucceeded();
}
}
if (error) {
action.logger.error(
"Action execution failed: " +
(error instanceof Error
? error.message
: String(error))
);
if (onExecuteFailed) {
onExecuteFailed(error);
}
}
} catch (e) {
action.logger.error(
`Unhandled error executing action: ${
e instanceof Error ? e.message : String(e)
}`
);
if (onError) {
onError(e);
}
} finally {
setSubmitting(false);
}
},