Skip to content

Instantly share code, notes, and snippets.

View trunghq3101's full-sized avatar

Miller Go Dev trunghq3101

View GitHub Profile
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import io.reactivex.Completable;
import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.Single;
import io.reactivex.SingleSource;
import io.reactivex.annotations.NonNull;
@trunghq3101
trunghq3101 / ApiModule.java
Created July 27, 2019 00:57 — forked from msangel/ApiModule.java
Retrofit 1 error handling behaviour in Retrofit 2.3.0
// Dagger 1 example
@Module(
complete = false,
library = true
)
public final class ApiModule {
@Provides
@Singleton
Retrofit provideRetrofit(Gson gson, Application app) {
return new Retrofit.Builder()
@trunghq3101
trunghq3101 / ErrorInterceptor.kt
Created July 27, 2019 00:50 — forked from yitz-grocerkey/ErrorInterceptor.kt
Retrofit RxJava global error handling in Kotlin
// for any errors that should be handled before being handed off to RxJava.
// In other words global error logic.
// An example might be 401 when not logging in
import okhttp3.Interceptor
import okhttp3.Response
class ErrorInterceptor: Interceptor {
override fun intercept(chain: Interceptor.Chain?): Response {