Class RestExceptionHandler
java.lang.Object
com.dmasone.identity.ecommerceapp.web.RestExceptionHandler
Central translation layer from application/domain failures to HTTP status
codes. Domain modules expose stable error codes without depending on web
framework types.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<ApiError> handleBadRequest(Exception exception) org.springframework.http.ResponseEntity<ApiError> handleDomainException(DomainException exception) org.springframework.http.ResponseEntity<ApiError> handleMethodNotAllowed(org.springframework.web.HttpRequestMethodNotSupportedException exception) org.springframework.http.ResponseEntity<ApiError> handleNotFound(org.springframework.web.servlet.resource.NoResourceFoundException exception) org.springframework.http.ResponseEntity<ApiError> handleUnreadableRequestBody(org.springframework.http.converter.HttpMessageNotReadableException exception) org.springframework.http.ResponseEntity<ApiError> handleUnsupportedMediaType(org.springframework.web.HttpMediaTypeNotSupportedException exception) org.springframework.http.ResponseEntity<ApiError> handleValidationException(org.springframework.web.bind.MethodArgumentNotValidException exception)
-
Constructor Details
-
RestExceptionHandler
public RestExceptionHandler()
-
-
Method Details
-
handleValidationException
@ExceptionHandler(org.springframework.web.bind.MethodArgumentNotValidException.class) public org.springframework.http.ResponseEntity<ApiError> handleValidationException(org.springframework.web.bind.MethodArgumentNotValidException exception) -
handleBadRequest
-
handleUnreadableRequestBody
@ExceptionHandler(org.springframework.http.converter.HttpMessageNotReadableException.class) public org.springframework.http.ResponseEntity<ApiError> handleUnreadableRequestBody(org.springframework.http.converter.HttpMessageNotReadableException exception) -
handleUnsupportedMediaType
@ExceptionHandler(org.springframework.web.HttpMediaTypeNotSupportedException.class) public org.springframework.http.ResponseEntity<ApiError> handleUnsupportedMediaType(org.springframework.web.HttpMediaTypeNotSupportedException exception) -
handleMethodNotAllowed
@ExceptionHandler(org.springframework.web.HttpRequestMethodNotSupportedException.class) public org.springframework.http.ResponseEntity<ApiError> handleMethodNotAllowed(org.springframework.web.HttpRequestMethodNotSupportedException exception) -
handleNotFound
@ExceptionHandler(org.springframework.web.servlet.resource.NoResourceFoundException.class) public org.springframework.http.ResponseEntity<ApiError> handleNotFound(org.springframework.web.servlet.resource.NoResourceFoundException exception)