Skip to content

Commit

Permalink
Merge pull request #249 from Link-MIND/docs/#248
Browse files Browse the repository at this point in the history
[#245] fix: crawler 방지 exception 추가
  • Loading branch information
sss4920 authored Oct 25, 2024
2 parents 23837ad + 2e52fba commit 0cbd396
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import jakarta.validation.ConstraintViolationException;
import lombok.NoArgsConstructor;
import lombok.RequiredArgsConstructor;
import org.springframework.web.servlet.resource.NoResourceFoundException;

@RestControllerAdvice
@Component
Expand Down Expand Up @@ -99,6 +100,13 @@ protected ResponseEntity<ApiResponse> MissingServletRequestParameterException(fi
.body(ApiResponse.error(Error.BAD_REQUEST_VALIDATION, Error.BAD_REQUEST_VALIDATION.getMessage()));
}

@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler(NoResourceFoundException.class)
protected ResponseEntity<ApiResponse> ServletCrawlerException(final NoResourceFoundException e, WebRequest request) {
return ResponseEntity.status(e.getStatusCode())
.body(ApiResponse.error(Error.BAD_REQUEST_VALIDATION, Error.BAD_REQUEST_VALIDATION.getMessage()));
}

@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler(HttpMessageNotReadableException.class)
protected ResponseEntity<ApiResponse> MissingServletRequestParameterException(final HttpMessageNotReadableException e, WebRequest request) {
Expand Down

0 comments on commit 0cbd396

Please sign in to comment.