Skip to content

Commit 523e1cc

Browse files
authored
Merge pull request #201 from GTable/feature/#186-payment-crud
refactor: 에러 메세지 수정
2 parents baadb33 + e3fa454 commit 523e1cc

3 files changed

Lines changed: 13 additions & 8 deletions

File tree

nowait-app-user-api/src/main/java/com/nowait/applicationuser/exception/GlobalExceptionHandler.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
package com.nowait.applicationuser.exception;
22

33
import static com.nowait.common.exception.ErrorMessage.*;
4-
import static org.springframework.http.HttpStatus.FORBIDDEN;
5-
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
6-
import static org.springframework.http.HttpStatus.BAD_REQUEST;
7-
import static org.springframework.http.HttpStatus.NOT_FOUND;
4+
import static org.springframework.http.HttpStatus.*;
85
import static org.springframework.http.HttpStatus.UNAUTHORIZED;
96

107
import java.util.Map;
@@ -35,6 +32,7 @@
3532
import com.nowait.domaincorerdb.reservation.exception.ReservationNotFoundException;
3633
import com.nowait.domaincorerdb.store.exception.StoreNotFoundException;
3734
import com.nowait.domaincorerdb.store.exception.StoreWaitingDisabledException;
35+
import com.nowait.domaincorerdb.storepayment.exception.StorePaymentNotFoundException;
3836
import com.nowait.domaincorerdb.token.exception.BusinessException;
3937
import com.nowait.domaincorerdb.user.exception.UserNotFoundException;
4038
import com.nowait.domainuserrdb.bookmark.exception.AlreadyDeletedBookmarkException;
@@ -238,6 +236,14 @@ public ErrorResponse handleStoreNotFoundException(StoreNotFoundException e, WebR
238236
return new ErrorResponse(e.getMessage(), STORE_NOT_FOUND.getCode());
239237
}
240238

239+
@ResponseStatus(NO_CONTENT)
240+
@ExceptionHandler(StorePaymentNotFoundException.class)
241+
public ErrorResponse handleStorePaymentNotFoundException(StorePaymentNotFoundException e, WebRequest request) {
242+
alarm(e, request);
243+
log.error("handleStorePaymentNotFoundException", e);
244+
return new ErrorResponse(e.getMessage(), STORE_PAYMENT_NOT_FOUND.getCode());
245+
}
246+
241247
// 공통 에러 Map 생성
242248
private static Map<String, String> getErrors(MethodArgumentNotValidException e) {
243249
return e.getBindingResult()

nowait-app-user-api/src/main/java/com/nowait/applicationuser/storepayment/controller/StorePaymentController.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,12 @@ public ResponseEntity<?> getStorePaymentByStoreId(@PathVariable Long storeId) {
4444
);
4545
} else {
4646
return ResponseEntity
47-
.status(HttpStatus.NO_CONTENT)
47+
.status(HttpStatus.OK)
4848
.body(
4949
ApiUtils.success(
50-
response
50+
"해당 주점의 등록된 결제 정보가 존재하지 않습니다."
5151
)
5252
);
5353
}
54-
5554
}
5655
}

nowait-domain/domain-core-rdb/src/main/java/com/nowait/domaincorerdb/storePayment/exception/StorePaymentNotFoundException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
public class StorePaymentNotFoundException extends RuntimeException {
66
public StorePaymentNotFoundException() {
7-
super(ErrorMessage.STORE_PAYMENT_PARAMETER_EMPTY.getMessage());
7+
super(ErrorMessage.STORE_PAYMENT_NOT_FOUND.getMessage());
88
}
99
}

0 commit comments

Comments
 (0)