Change PreventSubscriptionsSubject#errorAction to be more specific; to return an Exception

This commit is contained in:
Kyriakos Tharrouniatis 2020-02-16 23:31:33 +00:00
parent 2c0e4396d1
commit 2fffef5701
2 changed files with 3 additions and 3 deletions

View File

@ -40,9 +40,9 @@ class FlowSafeSubject<T, R>(private val actual: Subject<T, R>) : Observer<T> by
/** /**
* The [PreventSubscriptionsSubject] is used to prevent any subscriptions to its underlying [Subject]. * The [PreventSubscriptionsSubject] is used to prevent any subscriptions to its underlying [Subject].
*/ */
class PreventSubscriptionsSubject<T, R>(private val actual: Subject<T, R>, errorAction: () -> Unit) : Observer<T> by actual, class PreventSubscriptionsSubject<T, R>(private val actual: Subject<T, R>, errorAction: () -> Exception) : Observer<T> by actual,
Subject<T, R>(OnSubscribe<R> { _ -> Subject<T, R>(OnSubscribe<R> { _ ->
errorAction() throw errorAction()
}) { }) {
override fun hasObservers(): Boolean { override fun hasObservers(): Boolean {

View File

@ -226,7 +226,7 @@ class NodeVaultService(
"- aborting the flow " "- aborting the flow "
) )
throw FlowException( FlowException(
"Flow ${it.logic::class.java.name} tried to subscribe an Rx.Observer to VaultService.rawUpdates " + "Flow ${it.logic::class.java.name} tried to subscribe an Rx.Observer to VaultService.rawUpdates " +
"- Rx.Observables should only be subscribed outside the context of a flow " + "- Rx.Observables should only be subscribed outside the context of a flow " +
"- the subscription did not succeed " "- the subscription did not succeed "