Skip to content

Instantly share code, notes, and snippets.

View jacobras's full-sized avatar

Jacob Ras jacobras

View GitHub Profile
@jacobras
jacobras / dependabot.yml
Created March 5, 2025 15:56
Dependabot patch/minor update grouping
version: 2
updates:
- package-ecosystem: gradle
directory: "/"
schedule:
interval: daily
groups:
patch-updates:
update-types: [ "patch" ] # All patch updates go together in one PR. This may be merged when CI is green.
minor-updates:
import kotlinx.coroutines.CancellationException
/**
* Like [runCatching], but with proper coroutines cancellation handling. Also only catches [Exception] instead of [Throwable].
*
* Cancellation exceptions need to be rethrown. See https://github.com/Kotlin/kotlinx.coroutines/issues/1814.
*/
inline fun <R> resultOf(block: () -> R): Result<R> {
return try {
Result.success(block())
class MyUseCase {
suspend operator fun invoke() = runCatching { delay(1000) }
}
scope.launch {
myUseCase()
.onSuccess { println("Success") }
.onFailure { println("Failure") }
println("We're not stopping!")
}