fix: improve error handling in admin pages to show user-friendly error messages
- Add error display to help questions new/edit pages - Improve error visibility in admin-badges, admin-applications, admin-logs, admin-users pages - Update createHelpQuestion action to properly handle and display unique name collisions and database errors - Add user-friendly error messages to admin error handling - Enhances admin page error reporting for better user experience
This commit is contained in:
1 parent
d775e893f4
commit
0323c3fcaa
13 files changed
+222
-221
No files matched your search
@@ -48,11 +48,12 @@ export async function createHelpQuestion(formData: FormData): Promise<void> {
|
||||
targetType: "help_center_category",
|
||||
targetId: Number(entry.id),
|
||||
});
|
||||
} catch {
|
||||
// Unique name collision or DB error — re-render unchanged.
|
||||
} catch (error) {
|
||||
// Unique name collision or DB error — re-render unchanged with error.
|
||||
revalidatePath("/admin/help-questions");
|
||||
return;
|
||||
redirect("/admin/help-questions/new?error=Unique name collision or database error. Please try again.");
|
||||
}
|
||||
revalidatePath("/admin/help-questions");
|
||||
redirect("/admin/help-questions");
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user