Class Throwables
- java.lang.Object
- 
- org.keycloak.authorization.client.util.Throwables
 
- 
 public final class Throwables extends Object - Author:
- Pedro Igor
 
- 
- 
Constructor SummaryConstructors Constructor Description Throwables()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static RuntimeExceptionhandleWrapException(String message, Throwable cause)Handles ancauseand wraps it into aRuntimeException.static <V> VretryAndWrapExceptionIfNecessary(Callable<V> callable, TokenCallable token, String message, Throwable cause)Retries the givencallableafter obtaining a freshtokenfrom the server.
 
- 
- 
- 
Method Detail- 
handleWrapExceptionpublic static RuntimeException handleWrapException(String message, Throwable cause) Handles ancauseand wraps it into aRuntimeException. The resulting cause contains more details in case the givencauseis of aHttpResponseException.- Parameters:
- callable-
- pat-
- message- the message
- cause- the root cause
- Returns:
- a RuntimeExceptionwrapping the givencause
 
 - 
retryAndWrapExceptionIfNecessarypublic static <V> V retryAndWrapExceptionIfNecessary(Callable<V> callable, TokenCallable token, String message, Throwable cause) throws RuntimeException Retries the given callableafter obtaining a freshtokenfrom the server. If the attempt to retry fails the exception is handled as defined byhandleWrapException(String, Throwable).A retry is only attempted in case the causeis aHttpResponseExceptionwith a 403 status code. In some cases the session associated with the token is no longer valid and a new token must be issues.- Type Parameters:
- V- the result of the callable
- Parameters:
- callable- the callable to retry
- token- the token
- message- the message
- cause- the cause
- Returns:
- the result of the callable
- Throws:
- RuntimeException- in case the attempt to retry fails
 
 
- 
 
-