Skip to content

Commit

Permalink
feat: IOException Handler 메서드 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
hoonyworld committed Nov 14, 2024
1 parent b6f4689 commit 75a92c5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package org.sopt.makers.crew.main.global.advice;

import java.io.IOException;

import org.sopt.makers.crew.main.global.exception.BaseException;
import org.sopt.makers.crew.main.global.exception.ExceptionResponse;
import org.sopt.makers.crew.main.global.exception.ErrorStatus;
import org.sopt.makers.crew.main.global.exception.ExceptionResponse;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand Down Expand Up @@ -108,12 +110,19 @@ public ResponseEntity<ExceptionResponse> handleHttpRequestMethodNotSupportedExce
ErrorStatus.INVALID_INPUT_VALUE.getErrorCode()));
}

@ExceptionHandler(IOException.class)
public ResponseEntity<ExceptionResponse> handleIOException(IOException e) {
log.warn("{}", e.getMessage());
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
.body(ExceptionResponse.fail(
ErrorStatus.IO_EXCEPTION.getErrorCode()));
}

@ExceptionHandler(Exception.class)
public ResponseEntity<ExceptionResponse> handleException(Exception e) {
log.error("{}", e.getMessage());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(ExceptionResponse.fail(
ErrorStatus.INTERNAL_SERVER_ERROR.getErrorCode()));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public enum ErrorStatus {
CO_LEADER_CANNOT_APPLY("공동 모임장은 신청할 수 없습니다."),
LEADER_CANNOT_BE_CO_LEADER_APPLY("모임장은 공동 모임장이 될 수 없습니다."),
NOT_ALLOW_MEETING_APPLY("허용되지 않는 모임 신청입니다."),
IO_EXCEPTION("파일 입출력 오류가 발생했습니다."),

/**
* 401 UNAUTHORIZED
Expand Down

0 comments on commit 75a92c5

Please sign in to comment.