He probably forgot to add the implementation of handleFailure (I actually think he has it implemented in the BaseViewModel). Anyway, you could add a new state to the sealed class FriendsState:

and pass something useful in the Error class, like an error message depending on the error (exception) that happened, or the exception itself (then you can handle the error in the best way in the fragment/activity) and imlpement the handleFailure function like this (doing it assuming it accepts general failures):

As you can see, we are notifying the controller through the LiveData posting the relative result, then you can react to that listening to the LiveData results indeed, like he is already doing for other results:

--

--

--

Senior Android Engineer @WeTransfer 🤖 🇻🇪🇮🇹 Paraglider, Runner, Kayaker.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alessandro Mautone

Alessandro Mautone

Senior Android Engineer @WeTransfer 🤖 🇻🇪🇮🇹 Paraglider, Runner, Kayaker.

More from Medium

Common Wisdom — Mission Statement

First Launchpad Project of StarkNet Network: What is ZkPad?

Delirium