Top Description Inners Fields Constructors Methods
reactor.core

public abstract Class Exceptions

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Arrays, .Collections, .List, .Objects, java.util.concurrent.RejectedExecutionException, java.util.concurrent.atomic.AtomicReferenceFieldUpdater, reactor.core.publisher.Flux, reactor.util.Logger, .Loggers, reactor.util.annotation.Nullable, reactor.util.retry.Retry

Global Reactor Core Exception handling and utils to operate on.
Author
Stephane Maldini
See Also
Reactive-Streams-Commons

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class
Exceptions.CancelException

An error signal from downstream subscribers consuming data when their state is denying any additional event.

pack-priv static class
pack-priv static class
pack-priv static class
pack-priv static class
pack-priv static class
pack-priv static class
Exceptions.RetryExhaustedException

A specialized IllegalStateException to signify a retry has failed (eg.

public static class
Exceptions.SourceException

A Throwable that wraps the actual cause delivered via org.reactivestreams.Subscriber#onError(Throwable) in case of org.reactivestreams.Publishers that themselves emit items of type org.reactivestreams.Publisher.

pack-priv static class
Exceptions.StaticRejectedExecutionException

A RejectedExecutionException that is tailored for usage as a static final field.

pack-priv static class
Exceptions.StaticThrowable

A general-purpose Throwable that is suitable for usage as a static final field.

Field Summary

Modifier and TypeField and Description
public static final String
BACKPRESSURE_ERROR_QUEUE_FULL

A common error message used when a reactive streams source doesn't seem to respect backpressure signals, resulting in an operator's internal queue to be full.

private static final Logger
pack-priv static final RejectedExecutionException
pack-priv static final RejectedExecutionException
public static final Throwable
TERMINATED

A singleton instance of a Throwable indicating a terminal state for exceptions, don't leak this!

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public static final RuntimeException

Returns:

the (most of the time original) RuntimeException bearing the suppressed Throwable
addSuppressed
(RuntimeException
the original RuntimeException to bear a suppressed exception
original
,
Throwable
the Throwable to suppress
suppressed
)

Safely suppress a Throwable on a RuntimeException.

public static final Throwable

Returns:

the (most of the time original) Throwable bearing the suppressed Throwable
addSuppressed
(Throwable
the original Throwable to bear a suppressed exception
original
,
final Throwable
the Throwable to suppress
suppressed
)

Safely suppress a Throwable on an original Throwable.

public static <
the parent instance type
T
>
boolean

Returns:

true if added, false if the field contained the TERMINATED instance.
addThrowable
(AtomicReferenceFieldUpdater<T, Throwable>
the target field updater
field
,
T
the parent instance for the field
instance
,
Throwable
the Throwable to add.
exception
)

Update an empty atomic reference with the given exception, or combine further added exceptions together as suppressed exceptions under a root Throwable with the "Multiple exceptions" message, if the atomic reference already holds one.

public static RuntimeException

Returns:

an unchecked exception that should choose bubbling up over error callback path
bubble
(Throwable
the root cause
t
)

Prepare an unchecked RuntimeException that will bubble upstream if thrown by an operator.

public static IllegalStateException

Returns:

a new IllegalStateException with a cause message abiding to reactive stream specification rule 2.12.
duplicateOnSubscribeException
()

public static UnsupportedOperationException

Returns:

an UnsupportedOperationException indicating the error callback was not implemented and holding the original propagated error.
errorCallbackNotImplemented
(Throwable
original error not processed by a receiver.
cause
)

Return an UnsupportedOperationException indicating that the error callback on a subscriber was not implemented, yet an error was propagated.

public static RuntimeException

Returns:

a RuntimeException that can be identified via isCancel
failWithCancel
()

An exception that is propagated upward and considered as "fatal" as per Reactive Stream limited list of exceptions allowed to bubble.

public 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

public static IllegalStateException
failWithOverflow(String
the exception's message
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

public static RejectedExecutionException
public static RejectedExecutionException

Returns:

a new RejectedExecutionException with standard message and cause
failWithRejected
(Throwable
the original exception that caused the rejection
cause
)

Return a new RejectedExecutionException with standard message and cause, unless the cause is already a RejectedExecutionException created via failWithRejected(Throwable) (not the singleton-producing variants).

public static RejectedExecutionException

Returns:

a new RejectedExecutionException with custom message
failWithRejected
(String
the rejection message
message
)

Return a new RejectedExecutionException with given message.

public static RejectedExecutionException

Returns:

a singleton RejectedExecutionException
failWithRejectedNotTimeCapable
()

Return a singleton RejectedExecutionException with a message indicating the reason is due to the scheduler not being time-capable

public static boolean

Returns:

true if given Throwable is a bubbled wrapped exception.
isBubbling
(Throwable
the Throwable error to check
t
)

Check if the given exception is a bubbled wrapped exception.

public static boolean

Returns:

true if given Throwable is a cancellation token.
isCancel
(Throwable
the Throwable error to check
t
)

Check if the given error is a cancel signal.

public static boolean

Returns:

true if given Throwable is a callback not implemented exception.
isErrorCallbackNotImplemented
(Throwable
the Throwable error to check
t
)

Check if the given error is a callback not implemented exception, in which case its cause will be the propagated error that couldn't be processed.

public static boolean

Returns:

true if the throwable is considered fatal
isFatal
(Throwable
the Throwable to check
t
)

Check if a Throwable is considered by Reactor as Fatal and would be thrown by throwIfFatal(Throwable).

pack-priv static boolean
isFatalButNotJvmFatal(Throwable t)

Internal intermediate test that only detect Fatal but not Jvm Fatal exceptions.

public static boolean

Returns:

true if the throwable is considered Jvm Fatal
isJvmFatal
(Throwable
the Throwable to check
t
)

Check if a Throwable is considered by Reactor as Jvm Fatal and would be thrown by both throwIfFatal(Throwable) and throwIfJvmFatal(Throwable).

public static boolean

Returns:

true if the Throwable is an instance created by multiple(Throwable...), false otherwise
isMultiple
(Throwable
the Throwable to check, null always yields false
t
)

Check a Throwable to see if it is a composite, as created by multiple(Throwable...).

public static boolean

Returns:

true if the given Throwable represents an overflow.
isOverflow
(Throwable
the Throwable error to check
t
)

Check if the given exception represents an overflow.

public static boolean

Returns:

true if the Throwable is an instance representing retry exhaustion, false otherwise
isRetryExhausted
(Throwable
the Throwable to check, null always yields false
t
)

Check a Throwable to see if it indicates too many retry attempts have failed.

public static boolean

Returns:

true if the Throwable is a traceback, false otherwise
isTraceback
(Throwable
the Throwable to check, null always yields false
t
)

Check a Throwable to see if it is a traceback, as created by the checkpoint operator or debug utilities.

public static RuntimeException

Returns:

a composite exception with a standard message, and the given throwables as suppressed exceptions
multiple
(Throwable...
the exceptions to wrap into a composite
throwables
)

Create a composite exception that wraps the given Throwable(s), as suppressed exceptions.

public static RuntimeException

Returns:

a composite exception with a standard message, and the given throwables as suppressed exceptions
multiple
(Iterable<Throwable>
the exceptions to wrap into a composite
throwables
)

Create a composite exception that wraps the given Throwable(s), as suppressed exceptions.

public static IllegalArgumentException

Returns:

a new IllegalArgumentException with a cause message abiding to reactive stream specification rule 3.9.
nullOrNegativeRequestException
(long
the invalid requested demand
elements
)

public static RuntimeException

Returns:

an unchecked exception to propagate through onError signals.
propagate
(Throwable
the root cause
t
)

Prepare an unchecked RuntimeException that should be propagated downstream through org.reactivestreams.Subscriber#onError(Throwable).

public static RuntimeException

Returns:

a new RuntimeException representing retry exhaustion due to too many attempts
retryExhausted
(String
the message
message
,
Throwable
the cause of the last retry attempt that failed (or null if irrelevant)
cause
)

Return a new RuntimeException that represents too many failures on retry.

public static <
the instance type
T
>
Throwable

Returns:

the previously masked throwable
terminate
(AtomicReferenceFieldUpdater<T, Throwable>
the atomic container
field
,
T
the reference instance
instance
)

Atomic utility to safely mark a volatile throwable reference with a terminal marker.

public static void
throwIfFatal(Throwable
the exception to evaluate
t
)

Throws a particular Throwable only if it belongs to a set of "fatal" error varieties.

public static void
throwIfJvmFatal(Throwable
the exception to evaluate
t
)

Throws a particular Throwable only if it belongs to a set of "fatal" error varieties native to the JVM.

public static Throwable

Returns:

the unwrapped exception or current one if null
unwrap
(Throwable
the exception to unwrap
t
)

Unwrap a particular Throwable only if it is was wrapped via bubble or propagate.

public static List<Throwable>

Returns:

a List of the exceptions suppressed by the Throwable if multiple, or a List containing the Throwable otherwise. Null input results in an empty List.
unwrapMultiple
(Throwable
the Throwable to unwrap if multiple
potentialMultiple
)

Attempt to unwrap a Throwable into a List of Throwables.

public static List<Throwable>

Returns:

a List of the exceptions suppressed by the Throwable minus the tracebacks if multiple, or a List containing the Throwable otherwise. Null input results in an empty List.
unwrapMultipleExcludingTracebacks
(Throwable
the Throwable to unwrap if multiple
potentialMultiple
)

Attempt to unwrap a Throwable into a List of Throwables, excluding instances that are tracebacks.

public static Throwable
wrapSource(Throwable
the source sequence error signal
throwable
)

Wrap a Throwable delivered via org.reactivestreams.Subscriber#onError(Throwable) from an upstream org.reactivestreams.Publisher that itself emits org.reactivestreams.Publishers to distinguish the error signal from the inner sequence's processing errors.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait