Skip to content

Commit

Permalink
Merge pull request #168 from Gongjakso/refactor/search
Browse files Browse the repository at this point in the history
fix: Discord Webhook 오류 및 StackName 조건 오류 수정
  • Loading branch information
dl-00-e8 authored Jul 14, 2024
2 parents c28be8f + 5cbc618 commit 9628a13
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,7 @@ public Page<GetContestRes> getContestsByFilter(String sort, String meetingCity,
@Transactional(readOnly = true)
public Page<GetProjectRes> getProjectsByFilter(String sort, String meetingCity, String meetingTown, String stackName, String searchWord, Pageable page) {
// Validation
System.out.println("TEST");
if(stackName != null && (stackName.isBlank() || StackNameType.isValid(stackName))) {
if(stackName != null && !stackName.isBlank() && !StackNameType.isValid(stackName)) {
throw new ApplicationException(INVALID_VALUE_EXCEPTION);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@ public class GlobalExceptionHandler {
@ExceptionHandler(ApplicationException.class)
protected ResponseEntity<ErrorResponse> handleApplicationException(ApplicationException e){
log.error("{} {}", e, e.getErrorCode().toString());
discordClient.sendErrorMessage(e.getErrorCode().getCode(), e.getErrorCode().getMessage(), Arrays.toString(e.getStackTrace()));
// WebClient 관련 오류로 임시 비활성화
// discordClient.sendErrorMessage(e.getErrorCode().getCode(), e.getErrorCode().getMessage(), Arrays.toString(e.getStackTrace()));
return ResponseEntity.status(e.getErrorCode().getHttpStatus())
.body(new ErrorResponse(e.getErrorCode()));
}

@ExceptionHandler(RuntimeException.class)
protected ResponseEntity<ErrorResponse> handleRuntimeException(RuntimeException e) {
log.error(e.getMessage());
discordClient.sendErrorMessage(ErrorCode.INTERNAL_SERVER_EXCEPTION.getCode(), e.getMessage(), Arrays.toString(e.getStackTrace()));
// WebClient 오류로 임시 비활성화
// discordClient.sendErrorMessage(ErrorCode.INTERNAL_SERVER_EXCEPTION.getCode(), e.getMessage(), Arrays.toString(e.getStackTrace()));
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(new ErrorResponse(e.getMessage()));
}
Expand Down

0 comments on commit 9628a13

Please sign in to comment.