Skip to content

Commit

Permalink
feat: #44 에러 메세지 정리
Browse files Browse the repository at this point in the history
  • Loading branch information
dgh06175 committed Sep 26, 2024
1 parent 76b29ba commit 0746c45
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ private Playlist findPlaylistById(Long playlistId) {
private Playlist findPlaylistByIdWithValidation(Long playlistId, Member member) {
Playlist playlist = findPlaylistById(playlistId);
if (!playlist.getMember().equals(member)) {
throw new RestApiException(PlaylistErrorCode.PLAYLIST_UPDATE_FORBIDDEN);
throw new RestApiException(PlaylistErrorCode.PLAYLIST_FORBIDDEN);
}
return playlist;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@
import org.springframework.http.HttpStatus;

public enum PlaylistErrorCode implements ErrorCodeInterface{
PLAYLIST_NOT_FOUND("PLAYLIST001", "Playlist가 존재하지 않습니다.", HttpStatus.NOT_FOUND),
PLAYLIST_DELETE_FORBIDDEN("PLAYLIST002", "이 플레이리스트를 삭제할 권한이 없습니다.", HttpStatus.FORBIDDEN),
PLAYLIST_UPDATE_FORBIDDEN("PLAYLIST003", "이 플레이리스트를 업데이트할 권한이 없습니다.", HttpStatus.FORBIDDEN),
PLAYLIST_TRACK_NOT_FOUND("PLAYLIST004", "플레이리스트에 해당 트랙이 존재하지 않습니다.", HttpStatus.NOT_FOUND),
PLAYLIST_TRACK_DELETE_FORBIDDEN("PLAYLIST005", "이 플레이리스트의 트랙을 삭제할 권한이 없습니다.", HttpStatus.FORBIDDEN),
PLAYLIST_TRACK_DUPLICATE("PLAYLIST006", "이미 추가된 트랙입니다.", HttpStatus.BAD_REQUEST),
PLAYLIST_TRACK_COUNT_MISMATCH("PLAYLIST007", "요청한 트랙 순서 정보의 개수와 플레이리스트에 존재하는 트랙 개수가 일치하지 않습니다.", HttpStatus.BAD_REQUEST),
TRACK_NOT_FOUND("PLAYLIST008", "플레이리스트 안에 Track이 존재하지 않습니다.", HttpStatus.NOT_FOUND),
PLAYLIST_TRACK_ID_MISMATCH("PLAYLIST009", "플레이리스트에 존재하는 트랙 ID 들과 요청한 트랙 ID 들이 일치하지 않습니다.", HttpStatus.BAD_REQUEST),
PLAYLIST_NOT_FOUND("PLAYLIST001", "플레이리스트가 존재하지 않습니다.", HttpStatus.NOT_FOUND),
PLAYLIST_FORBIDDEN("PLAYLIST002", "이 플레이리스트 수정에 권한이 없는 유저입니다.", HttpStatus.FORBIDDEN),
PLAYLIST_TRACK_NOT_FOUND("PLAYLIST003", "플레이리스트에 해당 트랙이 존재하지 않습니다.", HttpStatus.NOT_FOUND),
PLAYLIST_TRACK_DUPLICATE("PLAYLIST004", "이미 추가된 트랙입니다.", HttpStatus.BAD_REQUEST),
PLAYLIST_TRACK_COUNT_MISMATCH("PLAYLIST005", "요청한 트랙 순서 정보의 개수와 플레이리스트에 존재하는 트랙 개수가 일치하지 않습니다.", HttpStatus.BAD_REQUEST),
PLAYLIST_TRACK_ID_MISMATCH("PLAYLIST006", "플레이리스트에 존재하는 트랙들의 정보와 요청한 트랙들의 정보가 일치하지 않습니다.", HttpStatus.BAD_REQUEST),
;

private final String code;
Expand Down

0 comments on commit 0746c45

Please sign in to comment.