Class ApiExceptionHandler

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

@Order(2147483647) @ControllerAdvice(annotations=com.totvs.tjf.api.context.stereotype.ApiGuideline.class) public final class ApiExceptionHandler extends Object
Exception interceptors to adjusts its contents as 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(java.lang.Exception.class) public org.springframework.http.ResponseEntity<com.totvs.tjf.api.context.response.ApiErrorResponse> handler(Exception exception, org.springframework.web.method.HandlerMethod handlerMethod)
      Generic handler for exceptions to adjust it's content to ApiErrorResponse to be serialized according to the TOTVS API Guideline.

      When the exception dont't have an ApiError its content is gone be considered a generic error with INTERNAL_SERVER_ERROR.

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