Browse Source

Use explicit onErrorMap(class.java) instead of reactor kotlin extension

pull/22911/head
Stephane Maldini 6 years ago
parent
commit
d45f7c4828
  1. 3
      spring-core-coroutines/src/main/kotlin/org/springframework/core/CoroutinesUtils.kt

3
spring-core-coroutines/src/main/kotlin/org/springframework/core/CoroutinesUtils.kt

@ -28,7 +28,6 @@ import kotlinx.coroutines.reactive.flow.asPublisher @@ -28,7 +28,6 @@ import kotlinx.coroutines.reactive.flow.asPublisher
import kotlinx.coroutines.reactor.mono
import reactor.core.publisher.Mono
import reactor.core.publisher.onErrorMap
import java.lang.reflect.InvocationTargetException
import java.lang.reflect.Method
import kotlin.reflect.full.callSuspend
@ -67,7 +66,7 @@ internal fun invokeHandlerMethod(method: Method, bean: Any, vararg args: Any?): @@ -67,7 +66,7 @@ internal fun invokeHandlerMethod(method: Method, bean: Any, vararg args: Any?):
val mono = GlobalScope.mono(Dispatchers.Unconfined) {
function.callSuspend(bean, *args.sliceArray(0..(args.size-2)))
.let { if (it == Unit) null else it }
}.onErrorMap(InvocationTargetException::class) { it.targetException }
}.onErrorMap(InvocationTargetException::class.java) { it.targetException }
if (function.returnType.classifier == Flow::class) {
mono.flatMapMany { (it as Flow<Any>).asPublisher() }
}

Loading…
Cancel
Save