Skip to content

Commit 3c4c879

Browse files
committed
hotfix : 이름 update nullable 방어 & 에러 메시지 구체화
1 parent 3a75aa2 commit 3c4c879

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/main/java/ita/tinybite/domain/user/service/UserService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public UserResDto getUser() {
4747
@Transactional
4848
public void updateUser(UpdateUserReqDto req) {
4949
User user = securityProvider.getCurrentUser();
50-
user.update(req);
50+
if(req.nickname() != null) user.update(req);
5151
}
5252

5353
@Transactional

src/main/java/ita/tinybite/global/exception/GlobalExceptionHandler.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import ita.tinybite.global.exception.errorcode.ErrorCode;
55
import ita.tinybite.global.response.APIResponse;
66
import jakarta.servlet.http.HttpServletRequest;
7+
8+
import java.time.LocalDateTime;
79
import java.util.NoSuchElementException;
810
import lombok.extern.slf4j.Slf4j;
911
import org.springframework.http.ResponseEntity;
@@ -53,11 +55,11 @@ public ResponseEntity<APIResponse<Void>> handle400Exception(RuntimeException exc
5355

5456
// 공통 에러 처리
5557
@ExceptionHandler(Exception.class)
56-
public ResponseEntity<APIResponse<Void>> handle500Exception(Exception exception, HttpServletRequest request) {
58+
public ResponseEntity<APIResponse<?>> handle500Exception(Exception exception, HttpServletRequest request) {
5759

5860
log.warn("URI : {}, {}", request.getRequestURI(), exception.getMessage(), exception);
5961
ErrorCode errorCode = CommonErrorCode.INTERNAL_SERVER_ERROR;
6062
return ResponseEntity.status(errorCode.getHttpStatus())
61-
.body(APIResponse.commonError(errorCode));
63+
.body(new APIResponse<>(errorCode.getHttpStatus().value(), errorCode.getHttpStatus().name(), exception.getMessage(), LocalDateTime.now(), null));
6264
}
6365
}

0 commit comments

Comments
 (0)