Retrofit 2 — Custom Call Adapter to Separate Network and Gson Errors

In the past weeks, you read an introduction to Retrofit call adapters and how to integrate various first-party call adapters (RxJava 1.x, RxJava 2.x, Guava). In another tutorial, you've learned how to implement a custom call adapter. In that tutorial, you implemented a custom call adapter, which separates the onResponse callback into more useful callbacks.

In this tutorial you'll implement a custom call adapter that separates the error callback into two more useful callbacks. Instead of getting one callback for all kinds of errors, you'll split it up into errors that happen during the Gson (de)serialization and other errors (like network issues).

Retrofit Series Overview


Continue reading

University Enrollment Required

Future Students benefit from value packed videos and tutorials.

Enroll to receive exclusive content or sign in if you’re already a Future Student.

Enroll me for $15/mo

Explore the Library

Find interesting tutorials and solutions for your problems.