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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.web.ErrorResponse
org.springframework.web.ErrorResponse.Builder
-
Constructor Summary
ConstructorsConstructorDescriptionApplicationException
(String message) ApplicationException
(String message, Throwable cause) ApplicationException의 생성자ApplicationException
(Throwable cause) -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ProblemDetail
getBody()
org.springframework.http.HttpStatusCode
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.web.ErrorResponse
getDetailMessageArguments, getDetailMessageArguments, getDetailMessageCode, getHeaders, getTitleMessageCode, getTypeMessageCode, updateAndGetBody
-
Constructor Details
-
ApplicationException
-
ApplicationException
-
ApplicationException
ApplicationException의 생성자다른 생성자들은 해당 생성자를 호출. HttpStatus는 500으로 생성
- Parameters:
message
- Exception messagecause
- 상위 cause
-
-
Method Details
-
getStatusCode
public org.springframework.http.HttpStatusCode getStatusCode()- Specified by:
getStatusCode
in interfaceorg.springframework.web.ErrorResponse
-
getBody
public org.springframework.http.ProblemDetail getBody()- Specified by:
getBody
in interfaceorg.springframework.web.ErrorResponse
-