public final class Throwables extends Object
| Constructor and Description |
|---|
Throwables() |
| Modifier and Type | Method and Description |
|---|---|
static RuntimeException |
handleWrapException(String message,
Throwable cause)
Handles an
cause and wraps it into a RuntimeException. |
static <V> V |
retryAndWrapExceptionIfNecessary(Callable<V> callable,
TokenCallable token,
String message,
Throwable cause)
Retries the given
callable after obtaining a fresh token from the server. |
public static RuntimeException handleWrapException(String message, Throwable cause)
cause and wraps it into a RuntimeException. The resulting cause contains
more details in case the given cause is of a HttpResponseException.callable - pat - message - the messagecause - the root causeRuntimeException wrapping the given causepublic static <V> V retryAndWrapExceptionIfNecessary(Callable<V> callable, TokenCallable token, String message, Throwable cause) throws RuntimeException
Retries the given callable after obtaining a fresh token from the server. If the attempt to retry fails
the exception is handled as defined by handleWrapException(String, Throwable).
A retry is only attempted in case the cause is a HttpResponseException with a 403 status code. In some cases the
session associated with the token is no longer valid and a new token must be issues.
V - the result of the callablecallable - the callable to retrytoken - the tokenmessage - the messagecause - the causeRuntimeException - in case the attempt to retry failsCopyright © 2019 JBoss by Red Hat. All rights reserved.