Skip to content

Commit

Permalink
refactor: 예외처리 방식 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
smartandhandsome committed Nov 7, 2023
1 parent 14f34c1 commit 1cea64f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 26 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import static com.google.firebase.messaging.MessagingErrorCode.INVALID_ARGUMENT;
import static com.google.firebase.messaging.MessagingErrorCode.UNREGISTERED;

import coffeemeet.server.common.execption.InvalidNotificationTokenException;
import coffeemeet.server.common.execption.InvalidInputException;
import coffeemeet.server.common.execption.NotificationFailException;
import coffeemeet.server.user.domain.NotificationInfo;
import com.google.firebase.messaging.FirebaseMessaging;
Expand Down Expand Up @@ -66,7 +66,7 @@ private void handleFirebaseMessagingException(FirebaseMessagingException e, Stri
MessagingErrorCode messagingErrorCode = e.getMessagingErrorCode();

if (messagingErrorCode == UNREGISTERED || messagingErrorCode == INVALID_ARGUMENT) {
throw new InvalidNotificationTokenException(INVALID_FCM_TOKEN,
throw new InvalidInputException(INVALID_FCM_TOKEN,
String.format(INVALID_FCM_TOKEN_MESSAGE, token));
}
throw new NotificationFailException(PUSH_NOTIFICATION_SEND_FAILURE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import coffeemeet.server.common.execption.GlobalErrorCode;
import coffeemeet.server.common.execption.InvalidAuthException;
import coffeemeet.server.common.execption.InvalidInputException;
import coffeemeet.server.common.execption.InvalidNotificationTokenException;
import coffeemeet.server.common.execption.MissMatchException;
import coffeemeet.server.common.execption.NotFoundException;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -51,14 +50,6 @@ public ResponseEntity<ErrorResponse> handleException(InvalidInputException excep
.body(ErrorResponse.of(exception.getErrorCode()));
}

@ExceptionHandler(InvalidNotificationTokenException.class)
public ResponseEntity<ErrorResponse> handleException(
InvalidNotificationTokenException exception) {
log.info(exception.getMessage(), exception);
return ResponseEntity.status(HttpStatus.NOT_FOUND)
.body(ErrorResponse.of(exception.getErrorCode()));
}

@ExceptionHandler(MissMatchException.class)
public ResponseEntity<ErrorResponse> handleException(MissMatchException exception) {
log.info(exception.getMessage(), exception);
Expand Down

0 comments on commit 1cea64f

Please sign in to comment.