is there a more arror idiomatic way to do this? ``...
# arrow
m
is there a more arror idiomatic way to do this?
Copy code
private 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 further
y
I think
Schedule
might help here? It has some
retry
method that does something like this.
m
Schedule
has such mechanism but it works based on
Raise<T>
T
. this is retrying based on successful response with
error
property, different
s
Can you call
raise
yourself in the response if you find that error property yourself?
m
oooh right, I’ll try. thanks
it works, thanks
🌟 1