Add error handling for database operations

cgen-dd6458c3fa9940209cafe1776735456b
This commit is contained in:
Builder.io 2025-08-16 04:29:40 +00:00
parent 1aa30b6ca7
commit c3a685403f

View file

@ -78,14 +78,25 @@ export default function Dashboard() {
try {
setIsLoading(true);
// Load user's projects
const userProjects = await aethexProjectService.getUserProjects(user!.id);
setProjects(userProjects);
// Load user's projects with error handling
let userProjects = [];
try {
userProjects = await aethexProjectService.getUserProjects(user!.id);
setProjects(userProjects);
} catch (projectError) {
console.warn("Could not load projects:", projectError);
setProjects([]);
}
// Load user's achievements
const userAchievements =
await aethexAchievementService.getUserAchievements(user!.id);
setAchievements(userAchievements);
// Load user's achievements with error handling
let userAchievements = [];
try {
userAchievements = await aethexAchievementService.getUserAchievements(user!.id);
setAchievements(userAchievements);
} catch (achievementError) {
console.warn("Could not load achievements:", achievementError);
setAchievements([]);
}
// Calculate stats
const activeCount = userProjects.filter(