Day95 of #100DaysOfCode

Day95 of #100DaysOfCode

Unit 4: Internet

try {
// some code that can cause an exception.
}
catch (e: SomeException) {
// handle the exception to avoid abrupt termination.
}
viewModelScope.launch {
try {
val listResult = MarsApi.retrofitService.getPhotos()
_status.value = listResult
} catch (e: Exception) {

}
}
catch (e: Exception) {
_status.value = "Failure: ${e.message}"
}

That is all for Day95 ✅

--

--

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