first commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package com.krt.flower.Flower.exception;
|
||||
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
@RestControllerAdvice
|
||||
public class ApiExceptionAdvice {
|
||||
|
||||
@ExceptionHandler({ApiException.class})
|
||||
public ResponseEntity<ApiExceptionEntity> exceptionHandler(ApiException apiEx) {
|
||||
|
||||
return ResponseEntity
|
||||
.status(apiEx.exceptionDto.getStatus())
|
||||
.body(ApiExceptionEntity.builder()
|
||||
.errorCode(apiEx.exceptionDto.getCode())
|
||||
.errorMessage(apiEx.exceptionDto.getMessage())
|
||||
.errorPoint(apiEx.exceptionDto.getErrorPoint())
|
||||
.build());
|
||||
}
|
||||
|
||||
@ExceptionHandler({TextException.class})
|
||||
public ResponseEntity<TextExceptionEntity> exceptionHandler(TextException apiEx) {
|
||||
|
||||
return ResponseEntity
|
||||
.status(apiEx.exceptionDto.getStatus())
|
||||
.body(TextExceptionEntity.builder()
|
||||
.errorCode(apiEx.exceptionDto.getCode())
|
||||
.errorMessage(apiEx.exceptionDto.getMessage())
|
||||
.build());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user