Skip to content

Commit 976a5b9

Browse files
committed
🍻 globalExceptionHAndler 분기 추가
1 parent e918864 commit 976a5b9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

backend/src/main/java/io/f1/backend/global/exception/handler/GlobalExceptionHandler.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import io.f1.backend.global.exception.errorcode.ErrorCode;
66
import io.f1.backend.global.exception.response.ErrorResponse;
77

8+
import jakarta.servlet.http.HttpServletRequest;
89
import lombok.extern.slf4j.Slf4j;
910

1011
import org.springframework.http.ResponseEntity;
@@ -28,8 +29,13 @@ public ResponseEntity<ErrorResponse> handleCustomException(CustomException e) {
2829
}
2930

3031
@ExceptionHandler(Exception.class)
31-
public ResponseEntity<ErrorResponse> handleException(Exception e) {
32+
public ResponseEntity<ErrorResponse> handleException(Exception e, HttpServletRequest request) {
3233
log.warn("handleException: {}", e.getMessage());
34+
35+
if ("text/event-stream".equals(request.getHeader("Accept"))) {
36+
return ResponseEntity.noContent().build();
37+
}
38+
3339
CommonErrorCode errorCode = CommonErrorCode.INTERNAL_SERVER_ERROR;
3440

3541
ErrorResponse response = new ErrorResponse(errorCode.getCode(), errorCode.getMessage());

0 commit comments

Comments
 (0)