Skip to content

Commit

Permalink
친구 링크 유효하지 않을 때 에러 메시지 수정 (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
asp345 authored Oct 11, 2024
1 parent fbcb6ee commit 6d78254
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions core/src/main/kotlin/common/exception/ErrorType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ enum class ErrorType(
THEME_NOT_FOUND(HttpStatus.NOT_FOUND, 40406, "테마를 찾을 수 없습니다.", "테마를 찾을 수 없습니다."),
EV_DATA_NOT_FOUND(HttpStatus.NOT_FOUND, 40407, "강의평 데이터를 찾을 수 없습니다.", "강의평 데이터를 찾을 수 없습니다."),
TAG_LIST_NOT_FOUND(HttpStatus.NOT_FOUND, 40408, "태그 리스트를 찾을 수 없습니다.", "태그 리스트를 찾을 수 없습니다."),
FRIEND_LINK_NOT_FOUND(HttpStatus.NOT_FOUND, 40409, "친구 링크가 유효하지 않습니다.", "친구 링크가 유효하지 않습니다."),

DUPLICATE_VACANCY_NOTIFICATION(HttpStatus.CONFLICT, 40900, "빈자리 알림 중복"),
DUPLICATE_EMAIL(HttpStatus.CONFLICT, 40901, "이미 사용 중인 이메일입니다.", "이미 사용 중인 이메일입니다."),
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/kotlin/common/exception/Snu4tException.kt
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ object ConfigNotFoundException : Snu4tException(ErrorType.CONFIG_NOT_FOUND)

object FriendNotFoundException : Snu4tException(ErrorType.FRIEND_NOT_FOUND)

object FriendLinkNotFoundException : Snu4tException(ErrorType.FRIEND_LINK_NOT_FOUND)

object UserNotFoundByNicknameException : Snu4tException(ErrorType.USER_NOT_FOUND_BY_NICKNAME)

object ThemeNotFoundException : Snu4tException(ErrorType.THEME_NOT_FOUND)
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/kotlin/friend/service/FriendService.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.wafflestudio.snu4t.friend.service

import com.wafflestudio.snu4t.common.exception.DuplicateFriendException
import com.wafflestudio.snu4t.common.exception.FriendLinkNotFoundException
import com.wafflestudio.snu4t.common.exception.FriendNotFoundException
import com.wafflestudio.snu4t.common.exception.InvalidDisplayNameException
import com.wafflestudio.snu4t.common.exception.InvalidFriendException
Expand Down Expand Up @@ -232,7 +233,7 @@ class FriendServiceImpl(
): Pair<Friend, User> {
val fromUserId =
redisTemplate.opsForValue()
.getAndAwait(FRIEND_LINK_REDIS_PREFIX + requestToken) ?: throw FriendNotFoundException
.getAndAwait(FRIEND_LINK_REDIS_PREFIX + requestToken) ?: throw FriendLinkNotFoundException
val fromUser = userRepository.findByIdAndActiveTrue(fromUserId) ?: throw UserNotFoundException
if (fromUser.id == userId) {
throw InvalidFriendException
Expand Down

0 comments on commit 6d78254

Please sign in to comment.