let (signal, sink) = Signal<[CLBeacon], BeaconManagerError>.pipe()
When I call this because the user disabled the Bluetooth:
sendError(self.sink, error)
the Signal
is interrupted and I don't receive more next
nor interrupted
events after enabling the Bluetooth back again. The Signal
is broken.
How can I send error
types to the observer
without interrupting / breaking the Signal
? I can't find in the RAC 4 documentation. Thanks!
If you want different semantics than
Next* (Error|Completed)
I recommend encoding that in the type. You can use aSignal
that can't fail, but which values can be either success or failure, by usingResult
:That
signal
will emit no errors, but itsNext
events will beResult.Success<[CLBeacon]>
orResult.Failure<BeaconManagerError>
, **and the signal won't terminate when receiving aResult.Failure
.By design, an error causes the signal to finish. The documentation says:
If you want to turn errors into
Next
events, you can useflatMapError
operator as described here or useretry
if you want to allow only several occurances of the error.