Marko Novaković
11/16/2024, 7:06 PMprivate suspend fun Raise<DomainError>.f(): List<String> {
val something = api.something().bind
return when (something.error) {
RateLimit -> {
delay(1_000)
f()
}
else -> something
}
}
this is a part of larger either {}
block and I wonder how to simplify it furtherYoussef Shoaib [MOD]
11/16/2024, 7:11 PMSchedule
might help here? It has some retry
method that does something like this.Marko Novaković
11/16/2024, 7:14 PMSchedule
has such mechanism but it works based on Raise<T>
T
. this is retrying based on successful response with error
property, differentStylianos Gakis
11/16/2024, 7:15 PMraise
yourself in the response if you find that error property yourself?Marko Novaković
11/16/2024, 7:15 PMMarko Novaković
11/16/2024, 7:38 PM