Skip to content

Commit 81f8280

Browse files
fix(likeActions, memberActions): handle errors gracefully by returning default values instead of throwing exceptions
1 parent e1d1119 commit 81f8280

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/app/actions/likeActions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export async function toggleLikeMember(targetUserId: string, isLiked: boolean) {
7373

7474
} catch (error) {
7575
console.log(error);
76-
throw error;
76+
return;
7777
}
7878
}
7979

@@ -95,7 +95,7 @@ export async function fetchCurrentUserLikeIds() {
9595
return likeIds.map(like => like.targetUserId);
9696
} catch (error) {
9797
console.log(error);
98-
throw error;
98+
return [];
9999
}
100100
}
101101

@@ -120,7 +120,7 @@ export async function fetchLikeMembers(type = 'source') {
120120
}
121121
} catch (error) {
122122
console.log(error);
123-
throw error;
123+
return [];
124124
}
125125
}
126126

src/app/actions/memberActions.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ export async function getMembers({
6666
}
6767
} catch (error) {
6868
console.log(error);
69-
throw error;
69+
return {
70+
items: [],
71+
totalCount: 0
72+
};
7073
}
7174
}
7275

0 commit comments

Comments
 (0)