From b389511ef297308f87d9a60c961f9af4355449d4 Mon Sep 17 00:00:00 2001 From: YoungJun Park Date: Thu, 7 Oct 2021 18:22:10 +0900 Subject: [PATCH] [#7] Exception Refactoring --- .../lazy/api/config/auth/CustomOAuth2UserService.java | 6 +++--- .../java/com/teamnexters/lazy/common/error/ErrorCode.java | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/api/src/main/java/com/teamnexters/lazy/api/config/auth/CustomOAuth2UserService.java b/api/src/main/java/com/teamnexters/lazy/api/config/auth/CustomOAuth2UserService.java index ba05d37..70f8075 100644 --- a/api/src/main/java/com/teamnexters/lazy/api/config/auth/CustomOAuth2UserService.java +++ b/api/src/main/java/com/teamnexters/lazy/api/config/auth/CustomOAuth2UserService.java @@ -1,6 +1,5 @@ package com.teamnexters.lazy.api.config.auth; import com.teamnexters.lazy.api.config.auth.dto.OAuthAttributes; -import com.teamnexters.lazy.api.config.auth.dto.SessionUser; import com.teamnexters.lazy.common.domain.member.Member; import com.teamnexters.lazy.common.domain.member.MemberRepository; import lombok.RequiredArgsConstructor; @@ -14,7 +13,6 @@ import org.springframework.security.oauth2.core.user.OAuth2User; import org.springframework.stereotype.Service; -import javax.servlet.http.HttpSession; import java.util.Collections; @Slf4j @@ -36,7 +34,7 @@ public class CustomOAuth2UserService implements OAuth2UserService entity.update(attributes.getName(),attributes.getPicture())) .orElse(attributes.toEntity()); + log.debug(">>> user Info : {}", user); + // DB에 저장 후 사용자 객체 반환 return memberRepository.save(user); } diff --git a/common/src/main/java/com/teamnexters/lazy/common/error/ErrorCode.java b/common/src/main/java/com/teamnexters/lazy/common/error/ErrorCode.java index 106b5e0..ac26bde 100644 --- a/common/src/main/java/com/teamnexters/lazy/common/error/ErrorCode.java +++ b/common/src/main/java/com/teamnexters/lazy/common/error/ErrorCode.java @@ -14,12 +14,14 @@ public enum ErrorCode { TOKEN_IS_EXPIRED(407, "C007", "토큰이 만료되었습니다."), INTERNAL_SERVER_ERROR(500, "C008", "서버 내부 에러입니다."), + EXTERNAL_SERVER_ERROR(501, "C009", "외부 API 통신 에러입니다."), // Member EMAIL_DUPLICATION(410, "M001", "이미 등록된 이메일입니다."), NICKNAME_DUPLICATION(411, "M002", "이미 등록된 닉네임입니다."), LOGIN_INPUT_INVALID(412, "M003", "잘못된 로그인 요청 값입니다."), OAUTH_PROVIDER_NOT_SUPPORT(413, "M004", "제공되지 않는 소셜로그인입니다."), + MEMBER_NOT_FOUND(414, "M005", "존재하지 않는 회원입니다."), // Habit HABIT_DUPLICATION(421, "H001", "이미 등록된 습관입니다.");