Class GlobalErrorHandler

java.lang.Object
com.dani.bff.error.GlobalErrorHandler

@RestControllerAdvice public class GlobalErrorHandler extends Object
Converts uncaught application exceptions into structured API errors.
  • Constructor Details

    • GlobalErrorHandler

      public GlobalErrorHandler()
  • Method Details

    • handleDownstreamFailure

      @ExceptionHandler(DownstreamServiceException.class) public org.springframework.http.ResponseEntity<ApiError> handleDownstreamFailure(DownstreamServiceException exception, org.springframework.web.server.ServerWebExchange exchange)
      Handles downstream failures that escape resilience fallbacks.
      Parameters:
      exception - downstream exception
      exchange - current request exchange
      Returns:
      structured error response
    • handleResponseStatus

      @ExceptionHandler(org.springframework.web.server.ResponseStatusException.class) public org.springframework.http.ResponseEntity<ApiError> handleResponseStatus(org.springframework.web.server.ResponseStatusException exception, org.springframework.web.server.ServerWebExchange exchange)
    • handleUnexpected

      @ExceptionHandler(java.lang.Exception.class) public org.springframework.http.ResponseEntity<ApiError> handleUnexpected(Exception exception, org.springframework.web.server.ServerWebExchange exchange)