Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: product-BadRequest Exception 처리를 위한 BadRequestException 구현 #15

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/main/kotlin/org/store/clothstar/common/error/ErrorCode.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ enum class ErrorCode(
OUT_OF_STOCK(HttpStatus.BAD_REQUEST, "품절된 상품입니다."),
INSUFFICIENT_STOCK(HttpStatus.BAD_REQUEST, "주문 개수가 상품 재고보다 더 많아 요청을 처리할 수 없습니다.");


// Product 관련 에러코드


fun ErrorCode(status: HttpStatus, message: String) {
this.status = status
this.message = message
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.store.clothstar.common.error.exception.order

import org.springframework.http.HttpStatus
import org.store.clothstar.common.error.ErrorCode

class BadRequestException(
val code: ErrorCode
) : RuntimeException(code.message) {
val httpStatus: HttpStatus
get() = code.status

val errorMessage: String
get() = code.message
}