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> handleNotFound(org.springframework.web.servlet.resource.NoResourceFoundException 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
@ExceptionHandler({jakarta.validation.ConstraintViolationException.class,org.springframework.web.method.annotation.MethodArgumentTypeMismatchException.class,org.springframework.web.HttpMediaTypeNotSupportedException.class,org.springframework.web.HttpRequestMethodNotSupportedException.class}) public org.springframework.http.ResponseEntity<ApiError> handleBadRequest(Exception exception) -
handleNotFound
@ExceptionHandler(org.springframework.web.servlet.resource.NoResourceFoundException.class) public org.springframework.http.ResponseEntity<ApiError> handleNotFound(org.springframework.web.servlet.resource.NoResourceFoundException exception)