Skip to content

Commit

Permalink
Deprecate flowWith with ERROR
Browse files Browse the repository at this point in the history
  • Loading branch information
qwwdfsad committed Aug 5, 2019
1 parent 41428a3 commit 55bead0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 386 deletions.
Expand Up @@ -238,7 +238,7 @@ public fun <T> Flow<T>.flowOn(context: CoroutineContext): Flow<T> {
* 4) It can be confused with [flowOn] operator, though [flowWith] is much rarer.
*/
@FlowPreview
@Deprecated(message = "flowWith is deprecated without replacement, please refer to its KDoc for an explanation", level = DeprecationLevel.WARNING) // Error in beta release, removal in 1.4
@Deprecated(message = "flowWith is deprecated without replacement, please refer to its KDoc for an explanation", level = DeprecationLevel.ERROR) // Error in beta release, removal in 1.4
public fun <T, R> Flow<T>.flowWith(
flowContext: CoroutineContext,
bufferSize: Int = BUFFERED,
Expand Down
154 changes: 0 additions & 154 deletions kotlinx-coroutines-core/common/test/flow/operators/FlowContextTest.kt

This file was deleted.

21 changes: 21 additions & 0 deletions kotlinx-coroutines-core/common/test/flow/operators/FlowOnTest.kt
Expand Up @@ -261,6 +261,27 @@ class FlowOnTest : TestBase() {
finish(3)
}

@Test
fun testException() = runTest {
val flow = flow {
emit(314)
delay(Long.MAX_VALUE)
}.flowOn(NamedDispatchers("upstream"))
.map {
throw TestException()
}

assertFailsWith<TestException> { flow.single() }
assertFailsWith<TestException>(flow)
ensureActive()
}

@Test
fun testIllegalArgumentException() {
val flow = emptyFlow<Int>()
assertFailsWith<IllegalArgumentException> { flow.flowOn(Job()) }
}

private inner class Source(private val value: Int) {
public var contextName: String = "unknown"

Expand Down

0 comments on commit 55bead0

Please sign in to comment.