mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-12-22 00:27:15 +00:00
updates in coroutines
This commit is contained in:
parent
c4a08e52e5
commit
2d662f91b3
@ -5,6 +5,10 @@
|
||||
* `Versions`:
|
||||
* `Kotlin`: `1.4.31` -> `1.4.32`
|
||||
* Add subproject `repos.cache`
|
||||
* `Coroutines`:
|
||||
* Rewrite `subscribeSafelyWithoutExceptions`
|
||||
* Now `subscribeSafelyWithoutExceptions` will use default handler instead of skipping
|
||||
* New extension `subscribeSafelySkippingExceptions`
|
||||
|
||||
## 0.4.30
|
||||
|
||||
|
@ -25,13 +25,25 @@ inline fun <T> Flow<T>.subscribeSafely(
|
||||
}
|
||||
|
||||
/**
|
||||
* Use [subscribeSafelyWithoutExceptions], but all exceptions inside of [safely] will be skipped
|
||||
* Use [subscribeSafelyWithoutExceptions], but all exceptions will be passed to [defaultSafelyExceptionHandler]
|
||||
*/
|
||||
inline fun <T> Flow<T>.subscribeSafelyWithoutExceptions(
|
||||
scope: CoroutineScope,
|
||||
noinline block: suspend (T) -> Unit
|
||||
) = subscribeSafely(
|
||||
scope,
|
||||
{},
|
||||
block
|
||||
)
|
||||
) = subscribe(scope) {
|
||||
safelyWithoutExceptions {
|
||||
block(it)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Use [subscribeSafelyWithoutExceptions], but all exceptions inside of [safely] will be skipped
|
||||
*/
|
||||
inline fun <T> Flow<T>.subscribeSafelySkippingExceptions(
|
||||
scope: CoroutineScope,
|
||||
noinline block: suspend (T) -> Unit
|
||||
) = subscribe(scope) {
|
||||
safelyWithoutExceptions({ /* skip exceptions */ }) {
|
||||
block(it)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user