George
01/27/2023, 11:17 AMNoSuchElementException
. Does not null count as a produced value?
suspend fun main(args: Array<String>) {
val someThingNullable: Any? = null
val result = mono { someThingNullable }.awaitSingle()
println(result)
}
Thanks in advance for any answer !Dmitry Khalanskiy [JB]
01/27/2023, 11:20 AMnull
does not count as a value. Also, reactive streams in general don't permit passing null
values through them.George
01/27/2023, 11:21 AMRiccardo Lippolis
01/27/2023, 11:22 AM.awaitSingleOrNull()
if you want to handle an empty mono as well. Keep in mind that there's a functional difference between a Mono that succeeds without emitting a value, and a Mono emitting a null
value. But in this case you're using the mono
function, which does not emit a value if the code block produces a null
value, but succeeds directly.