Package swiss.trustbroker.exception
Class GlobalExceptionHandler
java.lang.Object
swiss.trustbroker.exception.GlobalExceptionHandler
Spring MVC exception handler towards REST and WEB clients.
Exception stacks are not shown, except when DEBUG is enabled. This is needed because most of the exceptions below
are either thrown when data from the network is unexpected (in this case we can track back to code without the
exception stack, because the error message is speaking enough) or because under load we have threading problems
in which case the exception stack is more than needed and if caught and discarded in code within is lost otherwise.
-
Constructor Summary
ConstructorsConstructorDescriptionGlobalExceptionHandler(ApiSupport apiSupport, TrustBrokerProperties trustBrokerProperties) -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetMessageOfExceptionOrCause(Exception ex, boolean useToStringForCause) voidhandleAnyException(Exception ex, jakarta.servlet.http.HttpServletResponse response) org.springframework.http.ResponseEntity<String> handleDeniedException(swiss.trustbroker.common.exception.RequestDeniedException ex) org.springframework.http.ResponseEntity<String> handleTechnicalException(swiss.trustbroker.common.exception.TechnicalException ex) intstatic intlogException(Throwable ex, NetworkConfig networkConfig)
-
Constructor Details
-
GlobalExceptionHandler
-
-
Method Details
-
handleDeniedException
@ExceptionHandler(swiss.trustbroker.common.exception.RequestDeniedException.class) public org.springframework.http.ResponseEntity<String> handleDeniedException(swiss.trustbroker.common.exception.RequestDeniedException ex) -
handleTechnicalException
@ExceptionHandler(swiss.trustbroker.common.exception.TechnicalException.class) public org.springframework.http.ResponseEntity<String> handleTechnicalException(swiss.trustbroker.common.exception.TechnicalException ex) -
handleAnyException
-
logException
-
logException
-
getMessageOfExceptionOrCause
- Parameters:
ex-- Returns:
- message of the exception or of the root cause if the exception has a null message
-