Class ApplicationException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.github.can019.global.exception.ApplicationException
All Implemented Interfaces:
Serializable, org.springframework.web.ErrorResponse

public class ApplicationException extends RuntimeException implements org.springframework.web.ErrorResponse
RFC 7870에 맞는 error response를 제공할 수 있는 exception

생성 시 ProblemDetail을 초기화. GlobalExceptionHandler에서 ProblemDatail을 사용하여 body 구성. 프로젝트 내에서 새로운 exception을 정의하고자 할 때 해당 exception을 extedns하여 작성하면 됨. jakarta.servlet.http.HttpServletResponse을 참조하여 작성함.

Since:
0.0.3
See Also:
  • Constructor Details

    • ApplicationException

      public ApplicationException(String message)
    • ApplicationException

      public ApplicationException(Throwable cause)
    • ApplicationException

      public ApplicationException(String message, Throwable cause)
      ApplicationException의 생성자

      다른 생성자들은 해당 생성자를 호출. HttpStatus는 500으로 생성

      Parameters:
      message - Exception message
      cause - 상위 cause
  • Method Details

    • getStatusCode

      public org.springframework.http.HttpStatusCode getStatusCode()
      Specified by:
      getStatusCode in interface org.springframework.web.ErrorResponse
    • getBody

      public org.springframework.http.ProblemDetail getBody()
      Specified by:
      getBody in interface org.springframework.web.ErrorResponse