custom exception

    Custom Exception 활용법

    작성 이유Exception Handler 를 통한 예외 처리 작업을 하며 익혔던 예외 처리 방법을 기록하기 위해 작성하게 되었다. Exception Handler 를 통한 예외 처리customException 패키지에 추상 클래스인 GlobalException 과 GlobalException 클래스를 상속받는 두 개의 Custom Exception 클래스가 있다. ErrorResponse 클래스는 Exception Handler 를 통해 클라이언트로 반환하는 정보를 담고 있는 클래스. 간단한 게시글 단건 조회 Serivce 로직을 확인해보자. 이상한 게시글 아이디로 게시글을 찾는다면 IllegalArgumentException 이 발생하도록 되어있다. @Service public class PostSer..