Skip to content

Commit

Permalink
feat: 유저 권한 관련 ForbiddenException Handler 구현 #8
Browse files Browse the repository at this point in the history
  • Loading branch information
PgmJun committed Jan 23, 2024
1 parent 2541577 commit fb51f8b
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.nice.petudio.common.exception.error.ErrorCode;
import com.nice.petudio.common.exception.model.BadGatewayException;
import com.nice.petudio.common.exception.model.ConflictException;
import com.nice.petudio.common.exception.model.ForbiddenException;
import com.nice.petudio.common.exception.model.InternalServerException;
import com.nice.petudio.common.exception.model.NotFoundException;
import com.nice.petudio.common.exception.model.ValidationException;
Expand Down Expand Up @@ -70,6 +71,20 @@ protected ApiResponse<Object> handleInvalidFormatException(final Exception excep
return ApiResponse.error(ErrorCode.BAD_REQUEST_EXCEPTION);
}


/**
* 403 Forbidden
*/
// 요청에 대한 권한이 존재하지 않는 경우 발생
@ResponseStatus(HttpStatus.NOT_FOUND)
@ExceptionHandler(ForbiddenException.class)
protected ApiResponse<Object> handleForbiddenException(
ForbiddenException exception) {
log.error(exception.getMessage(), exception);
return ApiResponse.error(exception.getErrorCode());
}


/**
* 404 Not Found
*/
Expand Down

0 comments on commit fb51f8b

Please sign in to comment.