```.flatMap { response -> if (!r...
# rx
u
Copy code
.flatMap { response ->
               if (!response.isSuccessful) {
                    // TODO: errorResponse handling
                   return@flatMap Single.error(IllegalStateException("Response error"))
               }
              return@flatMap Single.just(response);
}
Copy code
Type inference failed: Not enough information to infer parameter T in

fun <T : Any!> error(exception: Throwable!) : Single<T!>!
Please specify it explicitly.
In java this works fine
Copy code
.flatMap(response -> {
         if (!response.isSuccessful()) {
             ResponseBody errorBody = response.errorBody();
             if (errorBody == null) {
                return Single.error(new IllegalStateException("Error response body is null"));
             }
         }
         return Single.just(response);
});