ErrorIfEmpty Operator

Rocket.error_if_emptyFunction
error_if_empty(err)

Creates a error_if_empty operator, which emits a given error if the source Observable completes without emitting any next value, otherwise mirrors the source Observable.

using Rocket

source = completed(Int) |> error_if_empty("Empty")

subscribe!(source, logger())
;

# output
[LogActor] Error: Empty

See also: AbstractOperator, InferableOperator, logger, map

source

Description

error_if_empty emits the values emitted by the source Observable or a specified error message if the source Observable is empty (completes without having emitted any next value).

See also

Operators