Skip to content

Commit

Permalink
feat: product-BadRequest Exception 처리를 위한 BadRequestException 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
Ogu1208 committed Aug 14, 2024
1 parent af54ef6 commit 5fb64db
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
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
}

0 comments on commit 5fb64db

Please sign in to comment.