Colton Idle
11/29/2019, 10:25 PMviewModelScope.launch {
val userProfileResponse = apiManager.client!!.getProfile()
if (userProfileResponse.isSuccessful) {
_viewState.value = _viewState.value?.copy(isLoading = false, profile = userProfileResponse.body())
} else {
Log.e(TAG, "Not success")
}
}
and it works!
BUT
I tried to run the app in airplane mode and it crashes. If I use a try catch it won't crash, but I'm confused by why the IDE doesn't force me to have a try/catch. Does anyone know why?octylFractal
11/29/2019, 10:25 PMColton Idle
11/29/2019, 10:27 PMoctylFractal
11/29/2019, 10:28 PMColton Idle
11/29/2019, 10:29 PMoctylFractal
11/29/2019, 10:29 PMColton Idle
11/29/2019, 10:31 PMe: Exception
that I'm catching, but I'm sure there's multiple different network error exceptions?octylFractal
11/29/2019, 10:32 PMIOException
unless you need more specificsColton Idle
11/29/2019, 10:33 PMgildor
11/30/2019, 3:26 PMColton Idle
11/30/2019, 3:28 PMThis is very specific crash which is fixedYou're talking about the crash in the blog post? Not my crash... right?
gildor
11/30/2019, 3:28 PMColton Idle
11/30/2019, 3:33 PMgildor
12/01/2019, 12:56 AMtry {
getProfile()
} catch (e: HttpException) {
e.response().errorBody()
}
Colton Idle
12/09/2019, 3:00 AMgildor
12/09/2019, 7:45 AM