Create team: Improve error handling when creating team.

This commit is contained in:
gbuomprisco
2024-11-01 14:46:29 +08:00
parent 3b88733d6c
commit 9681d51a08
2 changed files with 6 additions and 4 deletions

View File

@@ -76,9 +76,9 @@ function CreateOrganizationAccountForm(props: { onClose: () => void }) {
data-test={'create-team-form'} data-test={'create-team-form'}
onSubmit={form.handleSubmit((data) => { onSubmit={form.handleSubmit((data) => {
startTransition(async () => { startTransition(async () => {
try { const { error } = await createTeamAccountAction(data);
await createTeamAccountAction(data);
} catch { if (error) {
setError(true); setError(true);
} }
}); });

View File

@@ -31,7 +31,9 @@ export const createTeamAccountAction = enhanceAction(
if (error) { if (error) {
logger.error({ ...ctx, error }, `Failed to create team account`); logger.error({ ...ctx, error }, `Failed to create team account`);
throw new Error('Error creating team account'); return {
error: true,
};
} }
logger.info(ctx, `Team account created`); logger.info(ctx, `Team account created`);