Skip to content

Commit

Permalink
[#225] 테스트 코드 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
km2535 committed Sep 5, 2024
1 parent 508472d commit 850014d
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.speech.up.common.exception.handler;

import java.io.IOException;

import org.springframework.http.HttpStatus;
import org.springframework.http.HttpStatusCode;
import org.springframework.http.ResponseEntity;
Expand All @@ -15,6 +17,7 @@

@ControllerAdvice
public class ExceptionController {

@ExceptionHandler(MethodArgumentNotValidException.class)
public ResponseEntity<ApiExceptionResponse<Void>> handleMethodArgumentNotValidException(
MethodArgumentNotValidException exception) {
Expand Down Expand Up @@ -67,6 +70,7 @@ public ResponseEntity<ApiExceptionResponse<Void>> handleCustomException(CustomIl
HttpStatusCode.valueOf(exception.getErrorCode().getCode())
);
}

@ExceptionHandler(CustomIOException.class)
public ResponseEntity<ApiExceptionResponse<Void>> handleCustomException(CustomIOException exception) {
ApiExceptionResponse<Void> responseDto = ApiExceptionResponse.<Void>builder()
Expand All @@ -80,4 +84,14 @@ public ResponseEntity<ApiExceptionResponse<Void>> handleCustomException(CustomIO
);
}

@ExceptionHandler(NullPointerException.class)
public ResponseEntity<ApiExceptionResponse<Void>> handleNullPointerException(NullPointerException exception) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).build();
}

@ExceptionHandler(IOException.class)
public ResponseEntity<ApiExceptionResponse<Void>> handleIOException(IOException exception) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
}

}

0 comments on commit 850014d

Please sign in to comment.