I watched a talk by jw awhile back about how using...
# squarelibraries
r
I watched a talk by jw awhile back about how using the rx
onError
to handle network errors was bad practice. I’m trying to convert one of my calls that is modeled this way, but I’m finding that I lose a little bit of the functionality I relied on in handling network errors the other way. old way:
Copy code
someService.someCall()
    .subscribe({ response -> 
      //positive response things
    }, { e -> 
      when(e) {
        is HttpException -> //do something
        is UnknownHostException -> //do something else
    }
new way:
Copy code
someService.someCall()
    .subscribe({ response ->
      if(response.isSuccessful()){
        //positive response things
      } else {
        //can no longer check exception types here
      }
    },{ e ->
      //handle really bad stuff here
    })