Skip to content

Commit

Permalink
feat: 유저 정보 요청 관련 NotFoundException Handler 구현 #8
Browse files Browse the repository at this point in the history
  • Loading branch information
PgmJun committed Jan 23, 2024
1 parent 2cee355 commit 2541577
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.nice.petudio.common.exception.model.BadGatewayException;
import com.nice.petudio.common.exception.model.ConflictException;
import com.nice.petudio.common.exception.model.InternalServerException;
import com.nice.petudio.common.exception.model.NotFoundException;
import com.nice.petudio.common.exception.model.ValidationException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
Expand Down Expand Up @@ -81,6 +82,15 @@ protected ApiResponse<Object> handleNoResourceFoundException(
return ApiResponse.error(ErrorCode.NO_RESOURCE_FOUND_EXCEPTION);
}

// 존재하지 않는 데이터 요청 시 발생
@ResponseStatus(HttpStatus.NOT_FOUND)
@ExceptionHandler(NotFoundException.class)
protected ApiResponse<Object> handleNotFoundException(
NotFoundException exception) {
log.error(exception.getMessage(), exception);
return ApiResponse.error(exception.getErrorCode());
}


/**
* 405 Method Not Supported
Expand Down

0 comments on commit 2541577

Please sign in to comment.