public abstract class Exceptions extends Object
| Modifier and Type | Field and Description |
|---|---|
static boolean |
CANCEL_STACKTRACE
Deprecated.
Cancel stacktrace is always turned on given the exceptional
frequency and the critical info it can provide
|
static Throwable |
TERMINATED
A singleton instance of a Throwable indicating a terminal state for exceptions,
don't leak this!
|
| Modifier and Type | Method and Description |
|---|---|
static <T> boolean |
addThrowable(AtomicReferenceFieldUpdater<T,Throwable> field,
T instance,
Throwable exception) |
static NullPointerException |
argumentIsNullException() |
static RuntimeException |
bubble(Throwable t)
Return an unchecked
RuntimeException to be thrown that will bubble
upstream. |
static IllegalStateException |
duplicateOnSubscribeException() |
static UnsupportedOperationException |
errorCallbackNotImplemented(Throwable cause)
Return an
UnsupportedOperationException |
static RuntimeException |
failWithCancel()
An exception that is propagated upward and considered as "fatal" as per Reactive
Stream limited list of exceptions allowed to bubble.
|
static IllegalStateException |
failWithOverflow()
Return an
IllegalStateException indicating the receiver is overrun by
more signals than expected in case of a bounded queue, or more generally that data
couldn't be emitted due to a lack of request |
static IllegalStateException |
failWithOverflow(String message)
Return an
IllegalStateException indicating the receiver is overrun by
more signals than expected in case of a bounded queue or more generally that data
couldn't be emitted due to a lack of request |
static boolean |
isBubbling(Throwable t)
Check if the given error is a bubbled wrapped exception.
|
static boolean |
isCancel(Throwable t)
Check if the given error is a cancel signal.
|
static boolean |
isErrorCallbackNotImplemented(Throwable cause)
Return an
UnsupportedOperationException |
static boolean |
isOverflow(Throwable t) |
static IllegalArgumentException |
nullOrNegativeRequestException(long elements) |
static RuntimeException |
propagate(Throwable t)
Return an unchecked
RuntimeException to be thrown that will be propagated
downstream through Subscriber.onError(Throwable). |
static <T> Throwable |
terminate(AtomicReferenceFieldUpdater<T,Throwable> field,
T instance)
Atomic utility to safely mark a volatile throwable reference with a terminal
marker.
|
static void |
throwIfFatal(Throwable t)
Throws a particular
Throwable only if it belongs to a set of "fatal" error
varieties. |
static void |
throwIfJvmFatal(Throwable t)
Throws a particular
Throwable only if it belongs to a set of "fatal" error
varieties native to the JVM. |
static Throwable |
unwrap(Throwable t)
Unwrap a particular
Throwable only if it is a wrapped exception via
bubble(java.lang.Throwable) or propagate(java.lang.Throwable). |
@Deprecated public static final boolean CANCEL_STACKTRACE
public static final Throwable TERMINATED
public static <T> boolean addThrowable(AtomicReferenceFieldUpdater<T,Throwable> field, T instance, Throwable exception)
T - the parent instance typefield - the target field updaterinstance - the parent instance for the fieldexception - the Throwable to add.TERMINATED
instance.public static NullPointerException argumentIsNullException()
NullPointerException with a cause message abiding to reactive
stream specification.public static RuntimeException bubble(Throwable t)
RuntimeException to be thrown that will bubble
upstream. This method invokes throwIfFatal(Throwable).
t - the root causepublic static IllegalStateException duplicateOnSubscribeException()
IllegalStateException with a cause message abiding to
reactive stream specification.public static UnsupportedOperationException errorCallbackNotImplemented(Throwable cause)
UnsupportedOperationExceptioncause - original error not processed by a receiver.UnsupportedOperationExceptionpublic static RuntimeException failWithCancel()
RuntimeException that can be checked via isCancel(java.lang.Throwable)public static IllegalStateException failWithOverflow()
IllegalStateException indicating the receiver is overrun by
more signals than expected in case of a bounded queue, or more generally that data
couldn't be emitted due to a lack of requestIllegalStateExceptionpublic static IllegalStateException failWithOverflow(String message)
IllegalStateException indicating the receiver is overrun by
more signals than expected in case of a bounded queue or more generally that data
couldn't be emitted due to a lack of requestmessage - the exception's messageIllegalStateExceptionpublic static boolean isOverflow(Throwable t)
public static boolean isBubbling(Throwable t)
t - the Throwable error to checkpublic static boolean isCancel(Throwable t)
t - the Throwable error to checkpublic static boolean isErrorCallbackNotImplemented(Throwable cause)
UnsupportedOperationExceptioncause - original error not processed by a receiver.UnsupportedOperationExceptionpublic static IllegalArgumentException nullOrNegativeRequestException(long elements)
elements - the invalid requested demandIllegalArgumentException with a cause message abiding to
reactive stream specification.public static RuntimeException propagate(Throwable t)
RuntimeException to be thrown that will be propagated
downstream through Subscriber.onError(Throwable).
This method invokes throwIfFatal(Throwable).
t - the root causepublic static <T> Throwable terminate(AtomicReferenceFieldUpdater<T,Throwable> field, T instance)
T - the instance typefield - the atomic containerinstance - the reference instancepublic static void throwIfFatal(Throwable t)
Throwable only if it belongs to a set of "fatal" error
varieties. These varieties are as follows: BubblingExceptionErrorCallbackNotImplementedVirtualMachineErrorThreadDeathLinkageErrort - the exception to evaluatepublic static void throwIfJvmFatal(Throwable t)
Throwable only if it belongs to a set of "fatal" error
varieties native to the JVM. These varieties are as follows:
VirtualMachineErrorThreadDeathLinkageErrort - the exception to evaluatepublic static Throwable unwrap(Throwable t)
Throwable only if it is a wrapped exception via
bubble(java.lang.Throwable) or propagate(java.lang.Throwable).t - the exception to wrap