Package com.dani.bff.error
Class GlobalErrorHandler
java.lang.Object
com.dani.bff.error.GlobalErrorHandler
Converts uncaught application exceptions into structured API errors.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<ApiError> handleDownstreamFailure(DownstreamServiceException exception, org.springframework.web.server.ServerWebExchange exchange) Handles downstream failures that escape resilience fallbacks.org.springframework.http.ResponseEntity<ApiError> handleResponseStatus(org.springframework.web.server.ResponseStatusException exception, org.springframework.web.server.ServerWebExchange exchange) org.springframework.http.ResponseEntity<ApiError> handleUnexpected(Exception exception, org.springframework.web.server.ServerWebExchange exchange)
-
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 exceptionexchange- 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)
-