Class ExceptionHandlerExtensions
java.lang.Object
io.github.astrapi69.spring.exceptionhandling.ExceptionHandlerExtensions
The class
ExceptionHandlerExtensions
holds factory methods for create the view model bean
for exception representations-
Method Summary
Modifier and TypeMethodDescriptionstatic ExceptionViewModel
newExceptionViewModel
(jakarta.servlet.http.HttpServletRequest request, org.springframework.http.HttpStatus httpStatus, String developerMessage, String userMessage) Factory method for create a newExceptionViewModel
from the given argumentsstatic ExceptionViewModel
newExceptionViewModel
(org.springframework.web.context.request.ServletWebRequest request, org.springframework.http.HttpStatus status, String developerMessage, String userMessage) Factory method for create a newExceptionViewModel
from the given argumentsstatic ExceptionViewModel
newExceptionViewModelWith
(org.springframework.web.context.request.WebRequest request, org.springframework.http.HttpStatus status, String developerMessage, String userMessage) Factory method for create a newExceptionViewModel
from the given argumentsstatic org.springframework.http.ResponseEntity<Object>
newResponseEntity
(ExceptionViewModel exceptionViewModel) Factory method for create a newResponseEntity
with the givenExceptionViewModel
objectstatic org.springframework.http.ResponseEntity<Object>
newResponseEntity
(org.springframework.validation.BindException exception, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request, org.springframework.context.MessageSource messageSource) Factory method for create a newResponseEntity
from the given arguments
-
Method Details
-
newResponseEntity
public static org.springframework.http.ResponseEntity<Object> newResponseEntity(ExceptionViewModel exceptionViewModel) Factory method for create a newResponseEntity
with the givenExceptionViewModel
object- Parameters:
exceptionViewModel
- theExceptionViewModel
object- Returns:
- the new
ResponseEntity
object
-
newExceptionViewModelWith
public static ExceptionViewModel newExceptionViewModelWith(org.springframework.web.context.request.WebRequest request, org.springframework.http.HttpStatus status, String developerMessage, String userMessage) Factory method for create a newExceptionViewModel
from the given arguments- Parameters:
request
- the requeststatus
- the statusdeveloperMessage
- the developer messageuserMessage
- the user message- Returns:
- the new
ExceptionViewModel
object
-
newExceptionViewModel
public static ExceptionViewModel newExceptionViewModel(org.springframework.web.context.request.ServletWebRequest request, org.springframework.http.HttpStatus status, String developerMessage, String userMessage) Factory method for create a newExceptionViewModel
from the given arguments- Parameters:
request
- the requeststatus
- the statusdeveloperMessage
- the developer messageuserMessage
- the user message- Returns:
- the new
ExceptionViewModel
object
-
newExceptionViewModel
public static ExceptionViewModel newExceptionViewModel(jakarta.servlet.http.HttpServletRequest request, org.springframework.http.HttpStatus httpStatus, String developerMessage, String userMessage) Factory method for create a newExceptionViewModel
from the given arguments- Parameters:
request
- the requesthttpStatus
- the http statusdeveloperMessage
- the developer messageuserMessage
- the user message- Returns:
- the new
ExceptionViewModel
object
-
newResponseEntity
public static org.springframework.http.ResponseEntity<Object> newResponseEntity(org.springframework.validation.BindException exception, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request, org.springframework.context.MessageSource messageSource) Factory method for create a newResponseEntity
from the given arguments- Parameters:
exception
- the exceptionheaders
- the headersstatus
- the statusrequest
- the requestmessageSource
- the message source- Returns:
- the new
ResponseEntity
object
-