Class RestExceptionHandler

java.lang.Object
com.dmasone.identity.ecommerceapp.web.RestExceptionHandler

@RestControllerAdvice public class RestExceptionHandler extends Object
Central translation layer from application/domain failures to HTTP status codes. Domain modules expose stable error codes without depending on web framework types.
  • Constructor Details

    • RestExceptionHandler

      public RestExceptionHandler()
  • Method Details

    • handleDomainException

      @ExceptionHandler(DomainException.class) public org.springframework.http.ResponseEntity<ApiError> handleDomainException(DomainException exception)
    • 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)