File tree 1 file changed +5
-7
lines changed
kotlinx-coroutines-core/common/src/flow
1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -131,14 +131,12 @@ import kotlin.coroutines.*
131
131
*
132
132
* ### Exception transparency
133
133
*
134
- * Flow implementations never explicitly catch and ignore exceptions that occur in downstream flows .
135
- * From the implementation standpoint, it means that `catch` blocks that wrap calls to [emit][FlowCollector.emit] and [emitAll]
136
- * are not allowed to complete normally or attempt to call [emit][FlowCollector.emit], they are only allowed
137
- * to rethrow a caught exception or throw a different exception for diagnostics or application-specific purposes .
134
+ * When `emit` or `emitAll` throws, the Flow implementations must immediately stop emitting new values and finish with an exception .
135
+ * For diagnostics or application-specific purposes, the exception may be different from the one thrown by the emit operation,
136
+ * but then it will be suppressed, as discussed below.
137
+ * If there is a need to emit values after the downstream failed, please use the [catch][Flow.catch] operator .
138
138
*
139
- *
140
- * Exception handling with further emission in flows shall only be performed with
141
- * [catch][Flow.catch] operator, and it is designed to only catch exceptions coming from upstream flows while passing
139
+ * The [catch][Flow.catch] operator only catches upstream exceptions, but passes
142
140
* all downstream exceptions. Similarly, terminal operators like [collect][Flow.collect]
143
141
* throw any unhandled exceptions that occur in their code or in upstream flows, for example:
144
142
*
You can’t perform that action at this time.
0 commit comments