Class KiwiRetryerException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.kiwiproject.retry.KiwiRetryerException
-
- All Implemented Interfaces:
Serializable
public class KiwiRetryerException extends RuntimeException
Exception thrown byKiwiRetryer.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description KiwiRetryerException(String message, Throwable cause)Construct an instance with the given information.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<Throwable>unwrap()Unwrap the givenKiwiRetryerExceptionto reveal the underlying exception that caused it.Optional<Throwable>unwrapFully()Unwrap the givenKiwiRetryerExceptionto reveal the underlying exception that caused it.static Optional<Throwable>unwrapKiwiRetryerException(KiwiRetryerException kiwiRetryerEx)Unwrap the givenKiwiRetryerExceptionto reveal the underlying exception that caused it.static Optional<Throwable>unwrapKiwiRetryerExceptionFully(KiwiRetryerException kiwiRetryerEx)Unwrap the givenKiwiRetryerExceptionto reveal the underlying exception that caused it.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Method Detail
-
unwrapKiwiRetryerException
public static Optional<Throwable> unwrapKiwiRetryerException(KiwiRetryerException kiwiRetryerEx)
Unwrap the givenKiwiRetryerExceptionto reveal the underlying exception that caused it.If the given exception is an
ExecutionException(i.e. something bad and unexpected occurred during the retry attempts) then its cause will be returned. Otherwise return the direct cause, which is most likely aRetryException.Since it is possible for an attempt to fail without an exception, or for an
ExecutionExceptionto have a null cause, this method returns anOptionalto indicate there might not actually be an exception cause.- Parameters:
kiwiRetryerEx- the exception to unwrap- Returns:
- the unwrapped cause
- See Also:
unwrapKiwiRetryerExceptionFully(KiwiRetryerException)
-
unwrapKiwiRetryerExceptionFully
public static Optional<Throwable> unwrapKiwiRetryerExceptionFully(KiwiRetryerException kiwiRetryerEx)
Unwrap the givenKiwiRetryerExceptionto reveal the underlying exception that caused it.If the given exception is an
ExecutionException(i.e. something bad and unexpected occurred during the retry attempts) then its cause will be returned. If it is aRetryException, then unwrap it and return its cause.The difference between
unwrapKiwiRetryerException(KiwiRetryerException)and this method and is that the former does not unwrap theRetryException, whereas the latter (this method) does.Since it is possible for an attempt to fail without an exception, or for an
ExecutionExceptionto have a null cause, this method returns anOptionalto indicate there might not actually be an exception cause.- Parameters:
kiwiRetryerEx- the exception to unwrap- Returns:
- the fully unwrapped cause
-
unwrap
public Optional<Throwable> unwrap()
Unwrap the givenKiwiRetryerExceptionto reveal the underlying exception that caused it.- Returns:
- the unwrapped cause
- See Also:
unwrapKiwiRetryerException(KiwiRetryerException),unwrapFully()
-
unwrapFully
public Optional<Throwable> unwrapFully()
Unwrap the givenKiwiRetryerExceptionto reveal the underlying exception that caused it.- Returns:
- the fully unwrapped cause
- See Also:
unwrapKiwiRetryerExceptionFully(KiwiRetryerException)
-
-