diff --git a/src/main/java/com/softeer/backend/global/common/exception/ExceptionAdvice.java b/src/main/java/com/softeer/backend/global/common/exception/ExceptionAdvice.java index f25258d7..37a35938 100644 --- a/src/main/java/com/softeer/backend/global/common/exception/ExceptionAdvice.java +++ b/src/main/java/com/softeer/backend/global/common/exception/ExceptionAdvice.java @@ -1,5 +1,7 @@ package com.softeer.backend.global.common.exception; +import com.softeer.backend.fo_domain.draw.dto.participate.DrawLoseModalResponseDto; +import com.softeer.backend.fo_domain.draw.util.DrawUtil; import com.softeer.backend.fo_domain.fcfs.dto.result.FcfsFailResult; import com.softeer.backend.fo_domain.fcfs.dto.result.FcfsResultResponseDto; import com.softeer.backend.fo_domain.fcfs.exception.FcfsException; @@ -33,6 +35,7 @@ public class ExceptionAdvice extends ResponseEntityExceptionHandler { private final StaticResourceUtil staticResourceUtil; + private final DrawUtil drawUtil; /** * GeneralException을 처리하는 메서드 @@ -169,9 +172,15 @@ private ResponseEntity handleEventLockExceptionInternal(EventLockExcepti .build()); } - - //TODO - // DRAW 관련 예외일 경우, body 구성하는 코드 필요 + if (redissonKeyName.contains("DRAW")) { + body = ResponseDto.onSuccess( + DrawLoseModalResponseDto.builder() + .isDrawWin(false) + .images(drawUtil.generateLoseImages()) + .shareUrl("https://softeer.site") + .build() + ); + } return super.handleExceptionInternal( e, @@ -190,13 +199,13 @@ private ResponseEntity handleFcfsExceptionInternal(FcfsException e, Http if (e.getCode() == ErrorStatus._FCFS_ALREADY_CLOSED) { body = ResponseDto.onSuccess(FcfsResultResponseDto.builder() - .fcfsWinner(false) - .fcfsResult(FcfsFailResult.builder() - .title(textContentMap.get(StaticTextName.FCFS_CLOSED_TITLE.name())) - .subTitle(textContentMap.get(StaticTextName.FCFS_CLOSED_SUBTITLE.name())) - .caution(textContentMap.get(StaticTextName.FCFS_LOSER_CAUTION.name())) - .build()) - .build()); + .fcfsWinner(false) + .fcfsResult(FcfsFailResult.builder() + .title(textContentMap.get(StaticTextName.FCFS_CLOSED_TITLE.name())) + .subTitle(textContentMap.get(StaticTextName.FCFS_CLOSED_SUBTITLE.name())) + .caution(textContentMap.get(StaticTextName.FCFS_LOSER_CAUTION.name())) + .build()) + .build()); } else { body = ResponseDto.onFailure(e.getCode()); }