Skip to content

Commit 31a5981

Browse files
committed
feat(fe): add error handling with console.error
1 parent 54dc05a commit 31a5981

File tree

15 files changed

+42
-27
lines changed

15 files changed

+42
-27
lines changed

apps/client/.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
},
2828
"plugins": ["react-hooks", "react-refresh"],
2929
"rules": {
30+
"no-console": ["error", { "allow": ["warn", "error"] }],
3031
"@typescript-eslint/no-throw-literal": "off",
3132
"react/react-in-jsx-scope": "off",
3233
"react/require-default-props": "off",

apps/client/src/components/Header.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,17 @@ function Header() {
2222
const navigate = useNavigate();
2323

2424
const handleLogout = () =>
25-
logout().then(() => {
26-
clearAccessToken();
27-
navigate({ to: '/' });
28-
addToast({
29-
type: 'SUCCESS',
30-
message: '로그아웃 되었습니다.',
31-
duration: 3000,
32-
});
33-
});
25+
logout()
26+
.then(() => {
27+
clearAccessToken();
28+
navigate({ to: '/' });
29+
addToast({
30+
type: 'SUCCESS',
31+
message: '로그아웃 되었습니다.',
32+
duration: 3000,
33+
});
34+
})
35+
.catch(console.error);
3436

3537
return (
3638
<>

apps/client/src/components/modal/CreateQuestionModal.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ function CreateQuestionModal({ question }: CreateQuestionModalProps) {
4040
});
4141
closeModal();
4242
},
43+
onError: console.error,
4344
});
4445

4546
const { mutate: patchQuestionBodyQuery, isPending: isPatchInProgress } =
@@ -64,6 +65,7 @@ function CreateQuestionModal({ question }: CreateQuestionModalProps) {
6465
});
6566
closeModal();
6667
},
68+
onError: console.error,
6769
});
6870

6971
const submitDisabled =

apps/client/src/components/modal/CreateReplyModal.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ function CreateReplyModal({ question, reply }: CreateReplyModalProps) {
4747
closeModal();
4848
}
4949
},
50+
onError: console.error,
5051
});
5152

5253
const { mutate: patchReplyBodyQuery, isPending: isPatchInProgress } =
@@ -73,6 +74,7 @@ function CreateReplyModal({ question, reply }: CreateReplyModalProps) {
7374
closeModal();
7475
}
7576
},
77+
onError: console.error,
7678
});
7779

7880
const submitDisabled =

apps/client/src/components/modal/CreateSessionModal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ function CreateSessionModal() {
3333
params: { sessionId: res.sessionId },
3434
});
3535
},
36+
onError: console.error,
3637
});
3738

3839
const enableCreateSession =

apps/client/src/components/modal/SessionParticipantsModal.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ function SessionParticipantsModal() {
8484

8585
useEffect(() => {
8686
if (sessionId && sessionToken)
87-
getSessionUsers({ sessionId, token: sessionToken }).then(({ users }) => {
88-
setSessionUsers(users);
89-
});
87+
getSessionUsers({ sessionId, token: sessionToken })
88+
.then(({ users }) => {
89+
setSessionUsers(users);
90+
})
91+
.catch(console.error);
9092
}, [sessionId, sessionToken, setSessionUsers]);
9193

9294
const users = sessionUsers.filter(({ nickname }) =>

apps/client/src/components/qna/ChattingList.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ function ChattingList() {
8282
container.scrollTop = heightDiff;
8383
});
8484
})
85+
.catch(console.error)
8586
.finally(() => {
8687
setIsLoading(false);
8788
});

apps/client/src/components/qna/QuestionItem.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ function QuestionItem({ question, onQuestionSelect }: QuestionItemProps) {
7979
...res,
8080
});
8181
},
82+
onError: console.error,
8283
});
8384

8485
const handleLike = useCallback(
@@ -124,6 +125,7 @@ function QuestionItem({ question, onQuestionSelect }: QuestionItemProps) {
124125
closed: !question.closed,
125126
});
126127
},
128+
onError: console.error,
127129
});
128130

129131
const handleClose = () => {
@@ -163,6 +165,7 @@ function QuestionItem({ question, onQuestionSelect }: QuestionItemProps) {
163165
pinned: !question.pinned,
164166
});
165167
},
168+
onError: console.error,
166169
});
167170

168171
const handlePin = () => {
@@ -196,6 +199,7 @@ function QuestionItem({ question, onQuestionSelect }: QuestionItemProps) {
196199
});
197200
removeQuestion(question.questionId);
198201
},
202+
onError: console.error,
199203
});
200204

201205
const handleDelete = () => {

apps/client/src/components/qna/ReplyItem.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ function ReplyItem({ question, reply }: ReplyItemProps) {
5757
...res,
5858
});
5959
},
60+
onError: console.error,
6061
});
6162

6263
const handleLike = useCallback(
@@ -105,6 +106,7 @@ function ReplyItem({ question, reply }: ReplyItemProps) {
105106
deleted: true,
106107
});
107108
},
109+
onError: console.error,
108110
});
109111

110112
const handleDelete = () => {

apps/client/src/main.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ declare module '@tanstack/react-router' {
1818
}
1919
}
2020

21+
if (import.meta.env.MODE !== 'development') console.error = () => {};
22+
2123
createRoot(document.getElementById('root')!).render(
2224
<StrictMode>
2325
<QueryClientProvider client={queryClient}>

0 commit comments

Comments
 (0)