Skip to content

Commit

Permalink
refactor: 티켓팅 따닥 문제 발생 시 TooManyRequestException 예외 던지도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
seokjin8678 committed Jun 11, 2024
1 parent 7c82096 commit 40cda4c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

public class TooManyRequestException extends FestaGoException {

public TooManyRequestException() {
this(ErrorCode.TOO_FREQUENT_REQUESTS);
}

public TooManyRequestException(ErrorCode errorCode) {
super(errorCode);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.festago.common.exception.BadRequestException;
import com.festago.common.exception.ErrorCode;
import com.festago.common.exception.NotFoundException;
import com.festago.common.exception.TooManyRequestException;
import com.festago.ticketing.domain.Booker;
import com.festago.ticketing.domain.TicketQuantity;
import com.festago.ticketing.domain.TicketingRateLimiter;
Expand Down Expand Up @@ -45,7 +46,7 @@ private TicketQuantity getTicketQuantity(Long ticketId) {

private void validateFrequentTicketing(Booker booker) {
if (ticketingRateLimiter.isFrequentTicketing(booker, 5, TimeUnit.SECONDS)) {
throw new BadRequestException(ErrorCode.TOO_FREQUENT_REQUESTS);
throw new TooManyRequestException();
}
}
}

0 comments on commit 40cda4c

Please sign in to comment.