You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using retrofit2 with RxJava. I am using a clean architecture, Presentation, Domain. I a developing a RESTAPI and want to manage the situation where the database is new and the tables are empty (404)
Here is my API
interface UserApi {
@GET("users")
fun getUsers(): Single<List<UsersDTO>>
...
}
retrofit.create(UsersApi::class.java),
In the Presentation layer I receive the 404 retrofit2.adapter.rxjava3.HttpException as expected. However I do not want to import retrofit in the presentation layer but manage it in the data layer. Thoughts are to generate a custom exception shared between data and presentation or swallow the 404 in the data layer as no data is acceptable.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am using retrofit2 with RxJava. I am using a clean architecture, Presentation, Domain. I a developing a RESTAPI and want to manage the situation where the database is new and the tables are empty (404)
Here is my API
And here is part of my factory
And I use this to pass to may repository
retrofit.create(UsersApi::class.java),
In the Presentation layer I receive the 404 retrofit2.adapter.rxjava3.HttpException as expected. However I do not want to import retrofit in the presentation layer but manage it in the data layer. Thoughts are to generate a custom exception shared between data and presentation or swallow the 404 in the data layer as no data is acceptable.
Thanks all.
Beta Was this translation helpful? Give feedback.
All reactions