RejectedException

class RejectedException @JvmOverloads constructor(val rejection: Rejection, val events: List<Any> = emptyList()) : RuntimeException

A decide function's refusal thrown instead of returned: the kernel answers it exactly as the Decision.Rejected of rejection, so nothing is appended, a compensation runs as for a returned rejection, and the caller gets the same answer. Kotlin throws one with reject(code, message) (or DecideScope.reject); Java writes throw new RejectedException(Rejection.of("out-of-stock", "Only 2 left.")), and a handler may rethrow one.

It carries no stack trace: it is an answer, not an error. Its message is the rejection's, which the caller reads.

Constructors

Link copied to clipboard
constructor(rejection: Rejection, events: List<Any> = emptyList())

Properties

Link copied to clipboard

The events the rejection carries, ordinary events of the aggregate that it sources and that are appended with the rejection: an audit of the attempt, a counter of refusals. Empty: nothing is appended.

Link copied to clipboard

Functions

Link copied to clipboard
open override fun fillInStackTrace(): Throwable