https://kotlinlang.org logo
Title
n

Nick

01/05/2022, 9:24 PM
Is it possible to handle network connection issues when using a
watch
? You said they watchers never throw here. Is it possible to emit network connection issues?
m

mbonnin

01/06/2022, 7:21 AM
Not at the moment. Can you share more about the use case?
n

Nick

01/06/2022, 4:34 PM
My understanding is a watch will perform a network request and also monitor the cache right? So in the case where neither network or cache is available I’d like to be able to handle that situation.
m

mbonnin

01/06/2022, 11:33 PM
What I'd suggest is used some coroutines magic to emulate this:
apolloClient.query(query).toFlow()
        .catch { 
          // Handle errors here
        }
        .onCompletion {
          emitAll(apolloClient.query(query).watch())
        }
n

Nick

01/07/2022, 4:15 PM
thanks 🙂