From the course: Android Development: Retrofit with Java
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Handle failed requests - Android Tutorial
From the course: Android Development: Retrofit with Java
Handle failed requests
- [Instructor] Before we define any more methods - [Instructor] Before we define any more methods in the Github service interface, in the Github service interface, we should code the logic used to we should code the logic used to handle errors and failed requests. handle errors and failed requests. The Retrofit API made this a little easier for us The Retrofit API made this a little easier for us by including the .isSuccessful method by including the .isSuccessful method on the response object, but what is this doing on the response object, but what is this doing and how do we dig deeper to figure out and how do we dig deeper to figure out why an error occurred? why an error occurred? The first line in a response includes a code. The first line in a response includes a code. These HTTP response codes are used These HTTP response codes are used to indicate the result of the request, to indicate the result of the request, and they range…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.