Skip to content

Commit

Permalink
merge: [FE] 채팅 소켓 에러 핸들링 수정 (#197)
Browse files Browse the repository at this point in the history
merge: [FE] 채팅 소켓 에러 핸들링 수정 (#197)
  • Loading branch information
HBSPS authored Dec 6, 2023
2 parents 601246b + aee15a1 commit 7d2316b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions frontEnd/src/components/room/ChattingSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@ export default function ChattingSection() {
setAllMessage((prev) => [...prev, newMessage]);
};

const handleChattingSocketError = (errorMessage: string) => {
const errorResponse: ErrorResponse = JSON.parse(errorMessage);
const { statusCode } = errorResponse;
const handleChattingSocketError = (errorMessage: ErrorResponse) => {
const { statusCode } = errorMessage;

const { MESSAGE_ERROR_CODE, SERVER_ERROR_CODE, AI_ERROR_CODE } = CHATTING_ERROR_STATUS_CODE;
const { MESSAGE_ERROR_TEXT, SERVER_ERROR_TEXT, AI_ERROR_TEXT } = CHATTING_ERROR_TEXT;
Expand All @@ -103,7 +102,7 @@ export default function ChattingSection() {
});

socket.on(CHATTING_SOCKET_RECIEVE_EVNET.NEW_MESSAGE, handleRecieveMessage);
socket.on('error', handleChattingSocketError);
socket.on('exception', handleChattingSocketError);
socket.connect();

socket.emit(CHATTING_SOCKET_EMIT_EVNET.JOIN_ROOM, { room: roomId });
Expand Down

0 comments on commit 7d2316b

Please sign in to comment.