Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
수정한 코드
ErrorCode
: 비즈니스로직 에러메시지 수정LoggingAspect
: errorlog에GeneralException
의exceptionName
으로 수정GlobalExceptionHandler
: Dto에 잘못된 데이터타입으로 데이터가 들어온 경우 발생하는HttpMessageNotReadableException
다루는exceptionhandler
추가PreparationScheduleService
,PreparationUserService
,ScheduleService
:EntityNotFoundException
,AccessDeniedException
와 같은 Exception을GeneralException
으로 처리 (Api 응답 통일 및 비즈니스 로직에서 발생하는 예외는 generalException으로 처리하는 것이 적절)문제
GeneralException
에서 처리하지않는 예외가 발생할시, apiLog에서request.getRequestURI()
가/error
로 저장됨/error
로 나와 어느 api에서 에러가 발생한지 확인이 어려움문제 이유
BasicErrorController
가 /error 경로로 리디렉션하여 에러 페이지를 반환-> request.getRequestURI()를 호출하면 /error가 반환될 수 있음
해결방법
EntityNotFoundException
, .. 와 같은 exception을Generalexception
으로 처리를 바꾸면 requestUrl이 사용한 메서드로 저장됨추가적으로 수정한 부분
HttpMessageNotReadableException
로 컨트롤러 실행전에 발생하는 예외로,AOP(LoggingAspect)
는 컨트롤러 메서드가 실행될 때 동작하기 때문에 컨트롤러 실행 전 예외는LoggingAspect
에서 감지되지 않음ExceptionHandler
에서 errorllog 출력결과
AOP(LoggingAspect)
: api request 로그, api error 중 내부 로직 exception 로그를 Db에 저장 및 출력
ExceptionHandler
: 컨트롤러 실행 전 예외는 로그로 출력