Class ApiConstraintViolationExceptionHandler

java.lang.Object
com.totvs.tjf.api.response.error.handler.ApiConstraintViolationExceptionHandler

@Order(2147483647) @ControllerAdvice(annotations=com.totvs.tjf.api.context.stereotype.ApiGuideline.class) public final class ApiConstraintViolationExceptionHandler extends Object
ConstraintViolationException interceptor to adjust its contents as an ApiErrorResponse according to TOTVS API Guideline.
Note: This advice has Ordered.LOWEST_PRECEDENCE
Author:
Thiago A. de Souza Weber
  • Constructor Details

  • Method Details

    • handler

      @ExceptionHandler(javax.validation.ConstraintViolationException.class) public org.springframework.http.ResponseEntity<com.totvs.tjf.api.context.response.ApiErrorResponse> handler(javax.validation.ConstraintViolationException exception)
      Generic handler for ConstraintViolationException to adjust its content to an ApiErrorResponse to be serialized according to the TOTVS API Guideline.

      When the exception doesn't have an ApiError their content is going to be considered a generic error with BAD_REQUEST.

      Parameters:
      exception - to be handled
      Returns:
      an ApiErrorResponse to be serialized
      See Also: