Skip to content

Commit

Permalink
chore - #47 exceptionHandler의 response에 status 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
kseysh committed Jan 16, 2024
1 parent a56844b commit 670230f
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package sopt.org.HMH.global.common.response;

import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
Expand All @@ -12,8 +13,9 @@
public class CommonControllerAdvice {

@ExceptionHandler(value = ExceptionBase.class)
public ResponseEntity<?> ExceptionHandler(ExceptionBase exception) {
public ResponseEntity<?> ExceptionHandler(HttpServletResponse response, ExceptionBase exception) {
ErrorBase error = exception.getError();
response.setStatus(error.getHttpStatusCode());
return ResponseEntity
.status(error.getHttpStatus())
.body(
Expand Down

0 comments on commit 670230f

Please sign in to comment.