Skip to content

Commit

Permalink
#50 feat: Chat 예외처리 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
letskuku committed Aug 1, 2023
1 parent bf2a35f commit 7602815
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.example.cherrypickserver.chat.exception;

public class ChatNotFoundException extends RuntimeException {
public ChatNotFoundException() {
super("id에 알맞은 채팅방을 찾을 수 없습니다.");
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.example.cherrypickserver.chat.presentation;

import com.example.cherrypickserver.chat.exception.ChatNotFoundException;
import com.example.cherrypickserver.chat.exception.ChatSelectNotFoundException;
import com.example.cherrypickserver.chat.exception.SelectTypeNotFoundException;
import com.example.cherrypickserver.global.dto.ResponseCustom;
Expand All @@ -11,6 +12,12 @@
@RestControllerAdvice
public class ChatExceptionController {

@ExceptionHandler(ChatNotFoundException.class)
public ResponseCustom<String> catchChatNotFoundException(ChatNotFoundException e) {
log.error(e.getMessage());
return ResponseCustom.NOT_FOUND(e.getMessage());
}

@ExceptionHandler(ChatSelectNotFoundException.class)
public ResponseCustom<String> catchChatSelectNotFoundException(ChatSelectNotFoundException e) {
log.error(e.getMessage());
Expand Down

0 comments on commit 7602815

Please sign in to comment.